------------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  /Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files/stata_log_data.log
  log type:  text
 opened on:   7 May 2025, 20:52:30

. 
. ********************************************************************
. 
. *******************     DATASET CONSTRUCTION     *******************
. 
. ********************************************************************
. 
. **# CSHAPES DISTANCE DATA
. *Identifying direct land borders using CShapes 2.0
. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. insheet using "originals/cshapes.csv"
(6 vars, 1,918,461 obs)

. 
. gen neighbours = 1 if mindist == 0
(1,861,954 missing values generated)

. 
. drop if missing(neighbours)
(1,861,954 observations deleted)

. drop if ccode1 == ccode2
(13,973 observations deleted)

. drop if year<1989
(24,024 observations deleted)

. drop capdist centdist mindist neighbours

. 
. rename ccode1 referent

. rename ccode2 ccode

. 
. sort ccode year

. 
. save "temps/cshapes_mod.dta", replace
file temps/cshapes_mod.dta saved

. 
. **# SIPRI MCW DATA
. *Preparing SIPRI data on all MCW types for merging
. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. 
. *Converting from .csv to .dta
. import delimited "originals/sipri_1950-2024.csv"
(encoding automatically selected: ISO-8859-1)
(80 vars, 254 obs)

. save "originals/sipri.dta", replace
file originals/sipri.dta saved

. 
. * Rename variables to be more descriptive
. clear

. use "originals/sipri.dta"

. 
. foreach v of varlist _all {
  2.         local x : variable label `v'
  3.         local x = strtoname("`x'")
  4.         rename `v' Y`x'
  5. }

. 
. rename YRecipient recipient

. 
. drop Y_1950_2024 YPercentage_of_total YPercentage YSum_total_years

. 
. gen ccode=.
(254 missing values generated)

. order ccode

. 
. do "stata/texttocow.do" //Adding in COW country codes

. ***** TEXT TO CORRELATES OF WAR CODES *****
. * Derived from the work of Andreas Beger (2006) - https://www.andybeger.com/blog/2013-09-05-stata-do-files-for-country-code-conversions/
. 
. replace ccode=  2 if recipient=="United States of America"
(0 real changes made)

. replace ccode=  2 if recipient=="United States"
(1 real change made)

. replace ccode=  2 if recipient=="USA"
(0 real changes made)

. replace ccode= 20 if recipient=="Canada"
(1 real change made)

. replace ccode= 31 if recipient=="Bahamas"
(1 real change made)

. replace ccode= 31 if recipient=="Bahamas, The"
(0 real changes made)

. replace ccode= 40 if recipient=="Cuba"
(1 real change made)

. replace ccode= 41 if recipient=="Haiti"
(1 real change made)

. replace ccode= 42 if recipient=="Dominican Republic"
(1 real change made)

. replace ccode= 51 if recipient=="Jamaica"
(1 real change made)

. replace ccode= 52 if recipient=="Trinidad and Tobago"
(1 real change made)

. replace ccode= 52 if recipient=="Trinidad & Tobago"
(0 real changes made)

. replace ccode= 52 if recipient=="Trinidad &Tobago"
(0 real changes made)

. replace ccode= 53 if recipient=="Barbados"
(1 real change made)

. replace ccode= 54 if recipient=="Dominica"
(0 real changes made)

. replace ccode= 55 if recipient=="Grenada"
(1 real change made)

. replace ccode= 56 if recipient=="St. Lucia"
(0 real changes made)

. replace ccode= 57 if recipient=="St. Vincent and the Grenadines"
(0 real changes made)

. replace ccode= 57 if recipient=="St. Vincent & Grens."
(0 real changes made)

. replace ccode= 57 if recipient=="St. Vincent & Grenadines"
(0 real changes made)

. replace ccode= 57 if recipient=="St.Vincent & Grenadines"
(0 real changes made)

. replace ccode= 57 if recipient=="Saint Vincent"
(1 real change made)

. replace ccode= 58 if recipient=="Antigua & Barbuda"
(0 real changes made)

. replace ccode= 58 if recipient=="Antigua and Barbuda"
(1 real change made)

. replace ccode= 58 if recipient=="Antigua"
(0 real changes made)

. replace ccode= 60 if recipient=="St. Kitts and Nevis"
(0 real changes made)

. replace ccode= 60 if recipient=="St. Kitts & Nevis"
(0 real changes made)

. replace ccode= 60 if recipient=="Saint Kitts and Nevis"
(1 real change made)

. replace ccode= 60 if recipient=="Saint Kitts & Nevis"
(0 real changes made)

. replace ccode= 60 if recipient=="Saint Kitts"
(0 real changes made)

. replace ccode= 70 if recipient=="Mexico"
(1 real change made)

. replace ccode= 80 if recipient=="Belize"
(1 real change made)

. replace ccode= 90 if recipient=="Guatemala"
(1 real change made)

. replace ccode= 91 if recipient=="Honduras"
(1 real change made)

. replace ccode= 92 if recipient=="El Salvador"
(1 real change made)

. replace ccode= 93 if recipient=="Nicaragua"
(1 real change made)

. replace ccode= 94 if recipient=="Costa Rica"
(1 real change made)

. replace ccode= 95 if recipient=="Panama"
(1 real change made)

. replace ccode=100 if recipient=="Colombia"
(1 real change made)

. replace ccode=101 if recipient=="Venezuela"
(1 real change made)

. replace ccode=101 if recipient=="Venezuela, Rep. Bol."
(0 real changes made)

. replace ccode=110 if recipient=="Guyana"
(1 real change made)

. replace ccode=115 if recipient=="Suriname"
(1 real change made)

. replace ccode=130 if recipient=="Ecuador"
(1 real change made)

. replace ccode=135 if recipient=="Peru"
(1 real change made)

. replace ccode=140 if recipient=="Brazil"
(1 real change made)

. replace ccode=145 if recipient=="Bolivia"
(1 real change made)

. replace ccode=150 if recipient=="Paraguay"
(1 real change made)

. replace ccode=155 if recipient=="Chile"
(1 real change made)

. replace ccode=160 if recipient=="Argentina"
(1 real change made)

. replace ccode=165 if recipient=="Uruguay"
(1 real change made)

. replace ccode=200 if recipient=="United Kingdom"
(1 real change made)

. replace ccode=205 if recipient=="Ireland"
(1 real change made)

. replace ccode=210 if recipient=="Netherlands"
(1 real change made)

. replace ccode=211 if recipient=="Belgium"
(1 real change made)

. replace ccode=212 if recipient=="Luxembourg"
(1 real change made)

. replace ccode=220 if recipient=="France"
(1 real change made)

. replace ccode=221 if recipient=="Monaco"
(0 real changes made)

. replace ccode=223 if recipient=="Liechtenstein"
(0 real changes made)

. replace ccode=225 if recipient=="Switzerland"
(1 real change made)

. replace ccode=230 if recipient=="Spain"
(1 real change made)

. replace ccode=232 if recipient=="Andorra"
(0 real changes made)

. replace ccode=235 if recipient=="Portugal"
(1 real change made)

. replace ccode=255 if recipient=="Germany"
(1 real change made)

. replace ccode=260 if recipient=="German Federal Republic"
(0 real changes made)

. replace ccode=265 if recipient=="German Democratic Republic"
(0 real changes made)

. replace ccode=265 if recipient=="East Germany (GDR)"
(1 real change made)

. replace ccode=290 if recipient=="Poland"
(1 real change made)

. replace ccode=305 if recipient=="Austria"
(1 real change made)

. replace ccode=310 if recipient=="Hungary"
(1 real change made)

. replace ccode=315 if recipient=="Czechoslovakia"
(1 real change made)

. replace ccode=316 if recipient=="Czech Republic"
(0 real changes made)

. replace ccode=316 if recipient=="Czechia"
(1 real change made)

. replace ccode=317 if recipient=="Slovakia"
(1 real change made)

. replace ccode=317 if recipient=="Slovak Republic"
(0 real changes made)

. replace ccode=325 if recipient=="Italy"
(1 real change made)

. replace ccode=331 if recipient=="San Marino"
(0 real changes made)

. replace ccode=338 if recipient=="Malta"
(1 real change made)

. replace ccode=339 if recipient=="Albania"
(1 real change made)

. replace ccode=341 if recipient=="Montenegro"
(1 real change made)

. replace ccode=343 if recipient=="Macedonia"
(0 real changes made)

. replace ccode=343 if recipient=="North Macedonia"
(1 real change made)

. replace ccode=344 if recipient=="Croatia"
(1 real change made)

. replace ccode=345 if recipient=="Yugoslavia"
(1 real change made)

. replace ccode=345 if recipient=="Serbia and Montenegro"
(0 real changes made)

. replace ccode=345 if recipient=="Serbia"
(1 real change made)

. replace ccode=346 if recipient=="Bosnia and Herzegovina"
(0 real changes made)

. replace ccode=346 if recipient=="Bosnia-Herzegovina"
(1 real change made)

. replace ccode=347 if recipient=="Kosovo"
(1 real change made)

. replace ccode=349 if recipient=="Slovenia"
(1 real change made)

. replace ccode=350 if recipient=="Greece"
(1 real change made)

. replace ccode=352 if recipient=="Cyprus"
(1 real change made)

. replace ccode=355 if recipient=="Bulgaria"
(1 real change made)

. replace ccode=359 if recipient=="Moldova"
(1 real change made)

. replace ccode=360 if recipient=="Romania"
(1 real change made)

. replace ccode=365 if recipient=="Russia"
(1 real change made)

. replace ccode=365 if recipient=="Soviet Union"
(1 real change made)

. replace ccode=365 if recipient=="USSR"
(0 real changes made)

. replace ccode=366 if recipient=="Estonia"
(1 real change made)

. replace ccode=367 if recipient=="Latvia"
(1 real change made)

. replace ccode=368 if recipient=="Lithuania"
(1 real change made)

. replace ccode=369 if recipient=="Ukraine"
(1 real change made)

. replace ccode=370 if recipient=="Belarus"
(1 real change made)

. replace ccode=371 if recipient=="Armenia"
(1 real change made)

. replace ccode=372 if recipient=="Georgia"
(1 real change made)

. replace ccode=373 if recipient=="Azerbaijan"
(1 real change made)

. replace ccode=375 if recipient=="Finland"
(1 real change made)

. replace ccode=380 if recipient=="Sweden"
(1 real change made)

. replace ccode=385 if recipient=="Norway"
(1 real change made)

. replace ccode=390 if recipient=="Denmark"
(1 real change made)

. replace ccode=390 if recipient=="Denmark"
(0 real changes made)

. replace ccode=395 if recipient=="Iceland"
(1 real change made)

. replace ccode=402 if recipient=="Cape Verde"
(0 real changes made)

. replace ccode=402 if recipient=="Cabo Verde"
(1 real change made)

. replace ccode=403 if recipient=="Sao Tome and Principe"
(0 real changes made)

. replace ccode=404 if recipient=="Guinea-Bissau"
(1 real change made)

. replace ccode=411 if recipient=="Equatorial Guinea"
(1 real change made)

. replace ccode=420 if recipient=="Gambia"
(1 real change made)

. replace ccode=420 if recipient=="Gambia, The"
(0 real changes made)

. replace ccode=432 if recipient=="Mali"
(1 real change made)

. replace ccode=433 if recipient=="Senegal"
(1 real change made)

. replace ccode=434 if recipient=="Benin"
(1 real change made)

. replace ccode=435 if recipient=="Mauritania"
(1 real change made)

. replace ccode=436 if recipient=="Niger"
(1 real change made)

. replace ccode=437 if recipient=="Ivory Coast"
(0 real changes made)

. replace ccode=437 if recipient=="Côte d'Ivoire"
(0 real changes made)

. replace ccode=437 if recipient=="Cote d'Ivoire"
(1 real change made)

. replace ccode=437 if recipient=="Cote d`Ivoire"
(0 real changes made)

. replace ccode=438 if recipient=="Guinea"
(1 real change made)

. replace ccode=439 if recipient=="Burkina Faso"
(1 real change made)

. replace ccode=450 if recipient=="Liberia"
(1 real change made)

. replace ccode=451 if recipient=="Sierra Leone"
(1 real change made)

. replace ccode=452 if recipient=="Ghana"
(1 real change made)

. replace ccode=461 if recipient=="Togo"
(1 real change made)

. replace ccode=471 if recipient=="Cameroon"
(1 real change made)

. replace ccode=475 if recipient=="Nigeria"
(1 real change made)

. replace ccode=481 if recipient=="Gabon"
(1 real change made)

. replace ccode=482 if recipient=="Central African Republic"
(1 real change made)

. replace ccode=482 if recipient=="Central African Rep."
(0 real changes made)

. replace ccode=482 if recipient=="Central African Rep"
(0 real changes made)

. replace ccode=483 if recipient=="Chad"
(1 real change made)

. replace ccode=484 if recipient=="Congo"
(1 real change made)

. replace ccode=484 if recipient=="Congo, Republic of the"
(0 real changes made)

. replace ccode=484 if recipient=="Congo, Republic of"
(0 real changes made)

. replace ccode=484 if recipient=="Congo, Rep."
(0 real changes made)

. replace ccode=484 if recipient=="Congo, Rep"
(0 real changes made)

. replace ccode=484 if recipient=="Congo-Brazzaville"
(0 real changes made)

. replace ccode=484 if recipient=="Congo, Brazzaville"
(0 real changes made)

. replace ccode=490 if recipient=="Democratic Republic of the Congo"
(0 real changes made)

. replace ccode=490 if recipient=="Democratic Republic of Congo"
(0 real changes made)

. replace ccode=490 if recipient=="Congo, Democratic Republic of the"
(0 real changes made)

. replace ccode=490 if recipient=="Congo, Democratic Republic"
(0 real changes made)

. replace ccode=490 if recipient=="Congo, Dem. Rep. of"
(0 real changes made)

. replace ccode=490 if recipient=="Congo, Dem. Rep."
(0 real changes made)

. replace ccode=490 if recipient=="Congo-Kinshasa"
(0 real changes made)

. replace ccode=490 if recipient=="Congo, DR"
(0 real changes made)

. replace ccode=490 if recipient=="DR Congo"
(1 real change made)

. replace ccode=490 if recipient=="Zaire"
(0 real changes made)

. replace ccode=500 if recipient=="Uganda"
(1 real change made)

. replace ccode=501 if recipient=="Kenya"
(1 real change made)

. replace ccode=510 if recipient=="Tanzania"
(1 real change made)

. replace ccode=511 if recipient=="Zanzibar"
(0 real changes made)

. replace ccode=516 if recipient=="Burundi"
(1 real change made)

. replace ccode=517 if recipient=="Rwanda"
(1 real change made)

. replace ccode=520 if recipient=="Somalia"
(1 real change made)

. replace ccode=522 if recipient=="Djibouti"
(1 real change made)

. replace ccode=530 if recipient=="Ethiopia"
(1 real change made)

. replace ccode=531 if recipient=="Eritrea"
(1 real change made)

. replace ccode=540 if recipient=="Angola"
(1 real change made)

. replace ccode=541 if recipient=="Mozambique"
(1 real change made)

. replace ccode=551 if recipient=="Zambia"
(1 real change made)

. replace ccode=552 if recipient=="Zimbabwe"
(1 real change made)

. replace ccode=553 if recipient=="Malawi"
(1 real change made)

. replace ccode=560 if recipient=="South Africa"
(1 real change made)

. replace ccode=565 if recipient=="Namibia"
(1 real change made)

. replace ccode=570 if recipient=="Lesotho"
(1 real change made)

. replace ccode=571 if recipient=="Botswana"
(1 real change made)

. replace ccode=572 if recipient=="Swaziland"
(0 real changes made)

. replace ccode=572 if recipient=="eSwatini"
(1 real change made)

. replace ccode=580 if recipient=="Madagascar"
(1 real change made)

. replace ccode=581 if recipient=="Comoros"
(1 real change made)

. replace ccode=590 if recipient=="Mauritius"
(1 real change made)

. replace ccode=591 if recipient=="Seychelles"
(1 real change made)

. replace ccode=600 if recipient=="Morocco"
(1 real change made)

. replace ccode=615 if recipient=="Algeria"
(1 real change made)

. replace ccode=616 if recipient=="Tunisia"
(1 real change made)

. replace ccode=620 if recipient=="Libya"
(1 real change made)

. replace ccode=625 if recipient=="Sudan"
(1 real change made)

. replace ccode=626 if recipient=="South Sudan"
(1 real change made)

. replace ccode=630 if recipient=="Iran"
(1 real change made)

. replace ccode=630 if recipient=="Iran, Islamic Republic"
(0 real changes made)

. replace ccode=630 if recipient=="Iran, Ismalic Rep."
(0 real changes made)

. replace ccode=630 if recipient=="Iran, Ismalic Rep"
(0 real changes made)

. replace ccode=640 if recipient=="Turkey"
(0 real changes made)

. replace ccode=640 if recipient=="Turkiye"
(1 real change made)

. replace ccode=645 if recipient=="Iraq"
(1 real change made)

. replace ccode=651 if recipient=="Egypt"
(1 real change made)

. replace ccode=651 if recipient=="Egypt, Arab Republic"
(0 real changes made)

. replace ccode=651 if recipient=="Egypt, Arab Rep."
(0 real changes made)

. replace ccode=652 if recipient=="Syria"
(1 real change made)

. replace ccode=652 if recipient=="Syrian Arab Republic"
(0 real changes made)

. replace ccode=660 if recipient=="Lebanon"
(1 real change made)

. replace ccode=663 if recipient=="Jordan"
(1 real change made)

. replace ccode=666 if recipient=="Israel"
(1 real change made)

. replace ccode=670 if recipient=="Saudi Arabia"
(1 real change made)

. replace ccode=678 if recipient=="Yemen Arab Republic"
(0 real changes made)

. replace ccode=678 if recipient=="Yemen Arab Republic (North Yemen)"
(1 real change made)

. replace ccode=678 if recipient=="North Yemen"
(1 real change made)

. replace ccode=679 if recipient=="Yemen"
(1 real change made)

. replace ccode=679 if recipient=="Yemen, Rep."
(0 real changes made)

. replace ccode=679 if recipient=="Yemen, Republic of"
(0 real changes made)

. replace ccode=680 if recipient=="Yemen People's Republic"
(0 real changes made)

. replace ccode=680 if recipient=="Yemen PDR"
(0 real changes made)

. replace ccode=680 if recipient=="South Yemen"
(1 real change made)

. replace ccode=690 if recipient=="Kuwait"
(1 real change made)

. replace ccode=692 if recipient=="Bahrain"
(1 real change made)

. replace ccode=694 if recipient=="Qatar"
(1 real change made)

. replace ccode=696 if recipient=="United Arab Emirates"
(0 real changes made)

. replace ccode=696 if recipient=="UAE"
(1 real change made)

. replace ccode=698 if recipient=="Oman"
(1 real change made)

. replace ccode=700 if recipient=="Afghanistan"
(1 real change made)

. replace ccode=701 if recipient=="Turkmenistan"
(1 real change made)

. replace ccode=702 if recipient=="Tajikistan"
(1 real change made)

. replace ccode=703 if recipient=="Kyrgyzstan"
(1 real change made)

. replace ccode=703 if recipient=="Kyrgyz Republic"
(0 real changes made)

. replace ccode=704 if recipient=="Uzbekistan"
(1 real change made)

. replace ccode=705 if recipient=="Kazakhstan"
(1 real change made)

. replace ccode=710 if recipient=="China"
(1 real change made)

. replace ccode=710 if recipient=="China, People's Republic"
(0 real changes made)

. replace ccode=710 if recipient=="China, People's Rep."
(0 real changes made)

. replace ccode=710 if recipient=="China, People's Rep"
(0 real changes made)

. replace ccode=710 if recipient=="China, PRC"
(0 real changes made)

. replace ccode=710 if recipient=="China,P.R.: Mainland"
(0 real changes made)

. replace ccode=712 if recipient=="Mongolia"
(1 real change made)

. replace ccode=713 if recipient=="Taiwan"
(1 real change made)

. replace ccode=713 if recipient=="Taiwan, China"
(0 real changes made)

. replace ccode=730 if recipient=="Korea"
(0 real changes made)

. replace ccode=731 if recipient=="North Korea"
(1 real change made)

. replace ccode=731 if recipient=="Korea, Democratic Republic"
(0 real changes made)

. replace ccode=731 if recipient=="Democratic People's Republic of Korea"
(0 real changes made)

. replace ccode=731 if recipient=="Korea, Dem. Rep."
(0 real changes made)

. replace ccode=732 if recipient=="South Korea"
(1 real change made)

. replace ccode=732 if recipient=="Korea"
(0 real changes made)

. replace ccode=732 if recipient=="Korea, Republic of"
(0 real changes made)

. replace ccode=732 if recipient=="Republic of Korea"
(0 real changes made)

. replace ccode=732 if recipient=="Korea, Rep."
(0 real changes made)

. replace ccode=740 if recipient=="Japan"
(1 real change made)

. replace ccode=750 if recipient=="India"
(1 real change made)

. replace ccode=760 if recipient=="Bhutan"
(1 real change made)

. replace ccode=770 if recipient=="Pakistan"
(1 real change made)

. replace ccode=771 if recipient=="Bangladesh"
(1 real change made)

. replace ccode=775 if recipient=="Myanmar"
(1 real change made)

. replace ccode=780 if recipient=="Sri Lanka"
(1 real change made)

. replace ccode=781 if recipient=="Maldives"
(1 real change made)

. replace ccode=790 if recipient=="Nepal"
(1 real change made)

. replace ccode=800 if recipient=="Thailand"
(1 real change made)

. replace ccode=811 if recipient=="Cambodia"
(1 real change made)

. replace ccode=812 if recipient=="Laos"
(1 real change made)

. replace ccode=812 if recipient=="Lao People's Dem.Rep"
(0 real changes made)

. replace ccode=816 if recipient=="Vietnam"
(0 real changes made)

. replace ccode=816 if recipient=="Viet Nam"
(1 real change made)

. replace ccode=816 if recipient=="Viet Minh (France)*"
(1 real change made)

. replace ccode=816 if recipient=="Democratic Republic of Vietnam"
(0 real changes made)

. replace ccode=817 if recipient=="Republic of Vietnam"
(0 real changes made)

. replace ccode=817 if recipient=="Vietnam, Republic of"
(0 real changes made)

. replace ccode=817 if recipient=="Viet Cong (South Vietnam)*"
(1 real change made)

. replace ccode=817 if recipient=="South Vietnam"
(1 real change made)

. replace ccode=820 if recipient=="Malaysia"
(1 real change made)

. replace ccode=830 if recipient=="Singapore"
(1 real change made)

. replace ccode=835 if recipient=="Brunei"
(1 real change made)

. replace ccode=840 if recipient=="Philippines"
(1 real change made)

. replace ccode=850 if recipient=="Indonesia"
(1 real change made)

. replace ccode=860 if recipient=="East Timor"
(0 real changes made)

. replace ccode=860 if recipient=="Timor-Leste"
(1 real change made)

. replace ccode=900 if recipient=="Australia"
(1 real change made)

. replace ccode=910 if recipient=="Papua New Guinea"
(1 real change made)

. replace ccode=920 if recipient=="New Zealand"
(1 real change made)

. replace ccode=935 if recipient=="Vanuatu"
(1 real change made)

. replace ccode=940 if recipient=="Solomon Islands"
(1 real change made)

. replace ccode=946 if recipient=="Kiribati"
(0 real changes made)

. replace ccode=947 if recipient=="Tuvalu"
(0 real changes made)

. replace ccode=950 if recipient=="Fiji"
(1 real change made)

. replace ccode=955 if recipient=="Tonga"
(1 real change made)

. replace ccode=970 if recipient=="Nauru"
(0 real changes made)

. replace ccode=983 if recipient=="Marshall Islands"
(0 real changes made)

. replace ccode=986 if recipient=="Palau"
(0 real changes made)

. replace ccode=987 if recipient=="Federated States of Micronesia"
(0 real changes made)

. replace ccode=987 if recipient=="Micronesia"
(0 real changes made)

. replace ccode=987 if recipient=="Micronesia, Fed. Sts."
(0 real changes made)

. replace ccode=990 if recipient=="Samoa"
(0 real changes made)

. 
end of do-file

. 
. drop if missing(ccode)
(63 observations deleted)

. 
. *Countries that share COW codes (eg. Soviet Union and Russia) are separate in original SIPRI data so need to be merged together
. collapse (firstnm) Y_1950 Y_1951 Y_1952 Y_1953 Y_1954 Y_1955 Y_1956 Y_1957 Y_1958 Y_1959 Y_1960 Y_1961 Y_1962 Y_1963 Y_1964 Y_1965 Y_196
> 6 Y_1967 Y_1968 Y_1969 Y_1970 Y_1971 Y_1972 Y_1973 Y_1974 Y_1975 Y_1976 Y_1977 Y_1978 Y_1979 Y_1980 Y_1981 Y_1982 Y_1983 Y_1984 Y_1985 Y
> _1986 Y_1987 Y_1988 Y_1989 Y_1990 Y_1991 Y_1992 Y_1993 Y_1994 Y_1995 Y_1996 Y_1997 Y_1998 Y_1999 Y_2000 Y_2001 Y_2002 Y_2003 Y_2004 Y_20
> 05 Y_2006 Y_2007 Y_2008 Y_2009 Y_2010 Y_2011 Y_2012 Y_2013 Y_2014 Y_2015 Y_2016 Y_2017 Y_2018 Y_2019 Y_2020 Y_2021 Y_2022 Y_2023 Y_2024,
>  by(ccode)

. 
. *Originally a wide panel dataset, converting to long
. reshape long Y_, i(ccode) j(year)
(j = 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 197
> 6 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003
>  2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024)

Data                               Wide   ->   Long
-----------------------------------------------------------------------------
Number of observations              186   ->   13,950      
Number of variables                  76   ->   3           
j variable (75 values)                    ->   year
xij variables:
               Y_1950 Y_1951 ... Y_2024   ->   Y_
-----------------------------------------------------------------------------

. rename Y_ TIV

. 
. *Consistency with COW coding
. replace ccode=260 if ccode==255 & year<=1990
(41 real changes made)

. 
. save "temps/sipri_mod.dta", replace
file temps/sipri_mod.dta saved

. 
. **# MERGING CSHAPES AND NEIGHBOURS' SIPRI TIVs
. /*
> 1 = microstates (monaco, liechtenstein, andorra, and san marino) - not included in SIPRI??
> 2 = no neighbours, either due to no land border or country/data didn't exist in that year
> 3 = match
> */ 
. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. use "temps/cshapes_mod.dta"

. merge m:1 ccode year using temps/sipri_mod.dta
(variable ccode was int, now float to accommodate using data's values)

    Result                      Number of obs
    -----------------------------------------
    Not matched                         9,573
        from master                       163  (_merge==1)
        from using                      9,410  (_merge==2)

    Matched                            18,347  (_merge==3)
    -----------------------------------------

. 
. //drop if (year<1989 | year>=2020)
. drop if (year<1989)
(7,254 observations deleted)

. keep if _merge == 3
(2,319 observations deleted)

. drop _merge

. 
. rename ccode neighbour

. rename TIV neighbour_TIV

. 
. save "temps/cshapes_sipri.dta", replace
file temps/cshapes_sipri.dta saved

. 
. **# GENERATING COLLECTIVE IMPORTS
. /*
> summing up a country's neighbours' TIVs for a particular year. this generates duplicates where the country has multiple neighbours, so d
> ropped the duplicate observations. neighbour ccodes are also no longer necessary as each instance of the referent country should have th
> e same collective TIV
> */
. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. use "temps/cshapes_sipri.dta"

. 
. egen collective_TIV = total(neighbour_TIV), by(referent year)

. 
. drop neighbour_TIV neighbour

. duplicates drop

Duplicates in terms of all variables

(13,699 observations deleted)

. 
. rename referent ccode

. sort ccode year

. 
. save "temps/sipri_coll.dta", replace
file temps/sipri_coll.dta saved

. 
. **# MERGING CONFLICT COUNTRY SIPRI DATA INTO MAIN DATASET
. /*
> 1 = microstates (monaco, liechtenstein, andorra, and san marino) - not included in SIPRI??
> 2 = no neighbours, either due to no land border or country/data didn't exist in that year
> 3 = match
> */ 
. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. use "temps/sipri_coll.dta"

. 
. merge 1:1 ccode year using temps/sipri_mod.dta
(variable ccode was int, now float to accommodate using data's values)

    Result                      Number of obs
    -----------------------------------------
    Not matched                         9,518
        from master                       108  (_merge==1)
        from using                      9,410  (_merge==2)

    Matched                             4,540  (_merge==3)
    -----------------------------------------

. 
. //drop if (year<1989 | year>=2020)
. drop if year<1989
(7,254 observations deleted)

. keep if _merge == 3
(2,264 observations deleted)

. drop _merge

. 
. rename TIV self_TIV

. 
. replace self_TIV = self_TIV * 100
variable self_TIV was int now long
(2,903 real changes made)

. replace collective_TIV = collective_TIV * 100
(4,260 real changes made)

. 
. gen lncollective_TIV = ln(collective_TIV)
(280 missing values generated)

. gen lnself_TIV = ln(self_TIV)
(1,637 missing values generated)

. 
. save "temps/sipri_coll_self.dta", replace
file temps/sipri_coll_self.dta saved

. 
. **# BATTLE RELATED DEATHS
. /*
> INTRASTATE CONFLICTS ONLY
> 
> 1 = extrasystemic (state vs non-state outside its own territory)
> 2 = interstate (state vs state)
> 3 = intrastate (state vs non-state)
> 4 = internationalised intrastate (state vs non-state, but there is involvement of foreign govts with troops)
> */
. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. use "originals/BattleDeaths_v24_1_conf.dta"

. 
. keep if type_of_conflict == 3
(391 observations deleted)

. 
. drop dyad_id side_a side_b side_a_id side_b_id side_a_2nd side_b_2nd gwno_a gwno_b gwno_a_2nd gwno_b_2nd incompatibility version gwno_ba
> ttle location_inc bd_low bd_high type_of_conflict battle_location territory_name

. 
. rename gwno_loc ccode

. 
. destring ccode, replace
ccode: all characters numeric; replaced as int

. 
. replace ccode = 679 if ccode == 678 & year > 1990
(4 real changes made)

. 
. order ccode year bd_best

. sort ccode year

. 
. collapse (sum) bd_best, by(ccode year)

. 
. gen lnbd_best = ln(bd_best)

. 
. save "temps/ucdp_bd_mod.dta", replace
file temps/ucdp_bd_mod.dta saved

. 
. **# MERGING BR DEATHS INTO MAIN DATASET
. /*
> 1 = no BR-deaths in that countryyear
> 2 = islands/out of date range
> 3 = match
> */
. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. use "temps/sipri_coll_self.dta"

. 
. merge 1:1 ccode year using temps/ucdp_bd_mod.dta

    Result                      Number of obs
    -----------------------------------------
    Not matched                         4,009
        from master                     3,872  (_merge==1)
        from using                        137  (_merge==2)

    Matched                               668  (_merge==3)
    -----------------------------------------

. 
. //drop if (year<1989 | year>=2020)
. drop if year<1989
(0 observations deleted)

. drop if _merge == 2
(137 observations deleted)

. drop _merge

. 
. order ccode year bd_best lnbd_best collective_TIV self_TIV

. 
. save "temps/sipri_coll_self_bd.dta", replace
file temps/sipri_coll_self_bd.dta saved

. 
. //obs in ucdp only are ISLANDS or where there are coding differences (ie measuring during the year where the country became independent 
> vs the first full cal year)
. 
. **# CONTROL VARIABLES
. * WORLD ECONOMICS DATAVERSE
. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. insheet using "originals/popgdppolity1.csv"
(11 vars, 8,909 obs)

. 
. label var polity_p4 "Combined polity score"

. label var lnpop_wdi_pw "Population"

. label var lngdp_wdi_pw "GDP"

. label var lngdppc_wdi_pw "GDP Per Capita"

. 
. rename polity_p4 polity

. rename lnpop_wdi_pw lnpop

. rename lngdp_wdi_pw lngdp

. rename lngdppc_wdi_pw lngdppc

. 
. save "originals/popgdppolity1.dta", replace
file originals/popgdppolity1.dta saved

. 
. drop country gwno ifscode ifs gwabbrev polity

. 
. destring ccode lnpop lngdp lngdppc, replace force 
ccode: contains nonnumeric characters; replaced as int
(67 missing values generated)
lnpop: contains nonnumeric characters; replaced as double
(599 missing values generated)
lngdp: contains nonnumeric characters; replaced as double
(852 missing values generated)
lngdppc: contains nonnumeric characters; replaced as double
(852 missing values generated)

. 
. order ccode year

. sort ccode year

. 
. duplicates drop

Duplicates in terms of all variables

(2,241 observations deleted)

. drop if ccode == . //hong kong and macao don't have ccodes
(66 observations deleted)

. 
. save "temps/controls1.dta", replace
file temps/controls1.dta saved

. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. use "temps/sipri_coll_self_bd.dta"

. 
. merge 1:m ccode year using temps/controls1.dta

    Result                      Number of obs
    -----------------------------------------
    Not matched                         2,078
        from master                         8  (_merge==1)
        from using                      2,070  (_merge==2)

    Matched                             4,532  (_merge==3)
    -----------------------------------------

. 
. drop if (year<1989 | year>=2020)
(585 observations deleted)

. drop if _merge == 2
(1,485 observations deleted)

. drop _merge

. 
. save "temps/sipri_coll_self_bd_c1.dta", replace
file temps/sipri_coll_self_bd_c1.dta saved

. 
. **# GSDB DATA
. clear 

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. use "originals/GSDB_V4_dyadic.dta"

. 
. keep sanctioned_state_iso3 year arms

. 
. drop if (sanctioned_state_iso3 == "" | arms == 0)
(48,656 observations deleted)

. 
. gen ccode = .
(110,409 missing values generated)

. order ccode

. 
. do "stata/iso3tocow.do"

. ***** ISO3 TO CORRELATES OF WAR CODES *****
. * Derived from the work of Andreas Beger (2006) - https://www.andybeger.com/blog/2013-09-05-stata-do-files-for-country-code-conversions/
. 
. replace ccode=  2 if sanctioned_state_iso3=="USA"
(0 real changes made)

. replace ccode= 20 if sanctioned_state_iso3=="CAN"
(0 real changes made)

. replace ccode= 31 if sanctioned_state_iso3=="BHS"
(0 real changes made)

. replace ccode= 40 if sanctioned_state_iso3=="CUB"
(66 real changes made)

. replace ccode= 41 if sanctioned_state_iso3=="HTI"
(842 real changes made)

. replace ccode= 42 if sanctioned_state_iso3=="DOM"
(40 real changes made)

. replace ccode= 51 if sanctioned_state_iso3=="JAM"
(0 real changes made)

. replace ccode= 52 if sanctioned_state_iso3=="TTO"
(0 real changes made)

. replace ccode= 53 if sanctioned_state_iso3=="BRB"
(0 real changes made)

. replace ccode= 54 if sanctioned_state_iso3=="DMA"
(0 real changes made)

. replace ccode= 55 if sanctioned_state_iso3=="GRN"
(0 real changes made)

. replace ccode= 56 if sanctioned_state_iso3=="SLU"
(0 real changes made)

. replace ccode= 57 if sanctioned_state_iso3=="SVG"
(0 real changes made)

. replace ccode= 58 if sanctioned_state_iso3=="AAB"
(0 real changes made)

. replace ccode= 60 if sanctioned_state_iso3=="SKN"
(0 real changes made)

. replace ccode= 70 if sanctioned_state_iso3=="MEX"
(0 real changes made)

. replace ccode= 80 if sanctioned_state_iso3=="BLZ"
(0 real changes made)

. replace ccode= 90 if sanctioned_state_iso3=="GTM"
(7 real changes made)

. replace ccode= 91 if sanctioned_state_iso3=="HND"
(1 real change made)

. replace ccode= 92 if sanctioned_state_iso3=="SLV"
(1 real change made)

. replace ccode= 93 if sanctioned_state_iso3=="NIC"
(9 real changes made)

. replace ccode= 94 if sanctioned_state_iso3=="COS"
(0 real changes made)

. replace ccode= 95 if sanctioned_state_iso3=="PAN"
(0 real changes made)

. replace ccode=100 if sanctioned_state_iso3=="COL"
(1 real change made)

. replace ccode=101 if sanctioned_state_iso3=="VEN"
(283 real changes made)

. replace ccode=110 if sanctioned_state_iso3=="GUY"
(0 real changes made)

. replace ccode=115 if sanctioned_state_iso3=="SUR"
(0 real changes made)

. replace ccode=130 if sanctioned_state_iso3=="ECU"
(6 real changes made)

. replace ccode=135 if sanctioned_state_iso3=="PER"
(4 real changes made)

. replace ccode=140 if sanctioned_state_iso3=="BRA"
(0 real changes made)

. replace ccode=145 if sanctioned_state_iso3=="BOL"
(0 real changes made)

. replace ccode=150 if sanctioned_state_iso3=="PAR"
(0 real changes made)

. replace ccode=155 if sanctioned_state_iso3=="CHL"
(42 real changes made)

. replace ccode=160 if sanctioned_state_iso3=="ARG"
(25 real changes made)

. replace ccode=165 if sanctioned_state_iso3=="URU"
(0 real changes made)

. replace ccode=200 if sanctioned_state_iso3=="GBR"
(0 real changes made)

. replace ccode=205 if sanctioned_state_iso3=="IRE"
(0 real changes made)

. replace ccode=210 if sanctioned_state_iso3=="NTH"
(0 real changes made)

. replace ccode=211 if sanctioned_state_iso3=="BEL"
(0 real changes made)

. replace ccode=212 if sanctioned_state_iso3=="LUX"
(0 real changes made)

. replace ccode=220 if sanctioned_state_iso3=="FRA"
(0 real changes made)

. replace ccode=221 if sanctioned_state_iso3=="MNC"
(0 real changes made)

. replace ccode=223 if sanctioned_state_iso3=="LIE"
(0 real changes made)

. replace ccode=225 if sanctioned_state_iso3=="CHE"
(0 real changes made)

. replace ccode=230 if sanctioned_state_iso3=="ESP"
(0 real changes made)

. replace ccode=232 if sanctioned_state_iso3=="AND"
(0 real changes made)

. replace ccode=235 if sanctioned_state_iso3=="PRT"
(1,153 real changes made)

. replace ccode=255 if sanctioned_state_iso3=="DEU"
(0 real changes made)

. replace ccode=260 if (sanctioned_state_iso3=="DEU" & year<=1990)
(0 real changes made)

. replace ccode=265 if sanctioned_state_iso3=="DDR"
(0 real changes made)

. replace ccode=290 if sanctioned_state_iso3=="POL"
(31 real changes made)

. replace ccode=305 if sanctioned_state_iso3=="AUT"
(0 real changes made)

. replace ccode=310 if sanctioned_state_iso3=="HUN"
(31 real changes made)

. replace ccode=315 if sanctioned_state_iso3=="CSK"
(31 real changes made)

. replace ccode=316 if sanctioned_state_iso3=="CZE"
(0 real changes made)

. replace ccode=317 if sanctioned_state_iso3=="SVK"
(0 real changes made)

. replace ccode=325 if sanctioned_state_iso3=="ITA"
(0 real changes made)

. replace ccode=331 if sanctioned_state_iso3=="SMR"
(0 real changes made)

. replace ccode=338 if sanctioned_state_iso3=="MLT"
(0 real changes made)

. replace ccode=339 if sanctioned_state_iso3=="ALB"
(0 real changes made)

. replace ccode=341 if sanctioned_state_iso3=="MNE" & year > 2006
(0 real changes made)

. replace ccode=343 if sanctioned_state_iso3=="MKD"
(1,945 real changes made)

. replace ccode=344 if sanctioned_state_iso3=="HRV"
(1,461 real changes made)

. replace ccode=345 if sanctioned_state_iso3=="YUG"
(0 real changes made)

. replace ccode=345 if sanctioned_state_iso3=="SRB"
(1,951 real changes made)

. replace ccode=345 if sanctioned_state_iso3=="MNE" & year <= 2006
(1,953 real changes made)

. replace ccode=346 if sanctioned_state_iso3=="BIH"
(1,948 real changes made)

. replace ccode=347 if sanctioned_state_iso3=="XKX"
(0 real changes made)

. replace ccode=349 if sanctioned_state_iso3=="SVN"
(1,076 real changes made)

. replace ccode=350 if sanctioned_state_iso3=="GRC"
(4 real changes made)

. replace ccode=352 if sanctioned_state_iso3=="CYP"
(34 real changes made)

. replace ccode=355 if sanctioned_state_iso3=="BGR"
(0 real changes made)

. replace ccode=359 if sanctioned_state_iso3=="MDA"
(0 real changes made)

. replace ccode=360 if sanctioned_state_iso3=="ROU"
(0 real changes made)

. replace ccode=365 if sanctioned_state_iso3=="RUS"
(302 real changes made)

. replace ccode=365 if sanctioned_state_iso3=="SUN"
(0 real changes made)

. replace ccode=366 if sanctioned_state_iso3=="EST"
(0 real changes made)

. replace ccode=367 if sanctioned_state_iso3=="LVA"
(0 real changes made)

. replace ccode=368 if sanctioned_state_iso3=="LTU"
(0 real changes made)

. replace ccode=369 if sanctioned_state_iso3=="UKR"
(21 real changes made)

. replace ccode=370 if sanctioned_state_iso3=="BLR"
(221 real changes made)

. replace ccode=371 if sanctioned_state_iso3=="ARM"
(1,743 real changes made)

. replace ccode=372 if sanctioned_state_iso3=="GEO"
(3 real changes made)

. replace ccode=373 if sanctioned_state_iso3=="AZE"
(1,743 real changes made)

. replace ccode=375 if sanctioned_state_iso3=="FIN"
(0 real changes made)

. replace ccode=380 if sanctioned_state_iso3=="SWE"
(0 real changes made)

. replace ccode=385 if sanctioned_state_iso3=="NOR"
(0 real changes made)

. replace ccode=390 if sanctioned_state_iso3=="DNK"
(0 real changes made)

. replace ccode=395 if sanctioned_state_iso3=="ISL"
(0 real changes made)

. replace ccode=402 if sanctioned_state_iso3=="CPV"
(366 real changes made)

. replace ccode=403 if sanctioned_state_iso3=="STP"
(0 real changes made)

. replace ccode=404 if sanctioned_state_iso3=="GNB"
(366 real changes made)

. replace ccode=411 if sanctioned_state_iso3=="GNQ"
(0 real changes made)

. replace ccode=420 if sanctioned_state_iso3=="GMB"
(366 real changes made)

. replace ccode=432 if sanctioned_state_iso3=="MLI"
(366 real changes made)

. replace ccode=433 if sanctioned_state_iso3=="SEN"
(366 real changes made)

. replace ccode=434 if sanctioned_state_iso3=="BEN"
(366 real changes made)

. replace ccode=435 if sanctioned_state_iso3=="MRT"
(30 real changes made)

. replace ccode=436 if sanctioned_state_iso3=="NER"
(366 real changes made)

. replace ccode=437 if sanctioned_state_iso3=="CIV"
(2,676 real changes made)

. replace ccode=438 if sanctioned_state_iso3=="GIN"
(618 real changes made)

. replace ccode=439 if sanctioned_state_iso3=="BFA"
(366 real changes made)

. replace ccode=450 if sanctioned_state_iso3=="LBR"
(4,803 real changes made)

. replace ccode=451 if sanctioned_state_iso3=="SLE"
(2,825 real changes made)

. replace ccode=452 if sanctioned_state_iso3=="GHA"
(366 real changes made)

. replace ccode=461 if sanctioned_state_iso3=="TGO"
(404 real changes made)

. replace ccode=471 if sanctioned_state_iso3=="CMR"
(0 real changes made)

. replace ccode=475 if sanctioned_state_iso3=="NGA"
(2,439 real changes made)

. replace ccode=481 if sanctioned_state_iso3=="GAB"
(0 real changes made)

. replace ccode=482 if sanctioned_state_iso3=="CAF"
(2,112 real changes made)

. replace ccode=483 if sanctioned_state_iso3=="TCD"
(0 real changes made)

. replace ccode=484 if sanctioned_state_iso3=="COG"
(0 real changes made)

. replace ccode=490 if sanctioned_state_iso3=="COD"
(4,006 real changes made)

. replace ccode=500 if sanctioned_state_iso3=="UGA"
(0 real changes made)

. replace ccode=501 if sanctioned_state_iso3=="KEN"
(576 real changes made)

. replace ccode=510 if sanctioned_state_iso3=="TZA"
(0 real changes made)

. replace ccode=511 if sanctioned_state_iso3=="EAZ"
(0 real changes made)

. replace ccode=516 if sanctioned_state_iso3=="BDI"
(32 real changes made)

. replace ccode=517 if sanctioned_state_iso3=="RWA"
(2,810 real changes made)

. replace ccode=520 if sanctioned_state_iso3=="SOM"
(6,052 real changes made)

. replace ccode=522 if sanctioned_state_iso3=="DJI"
(0 real changes made)

. replace ccode=530 if sanctioned_state_iso3=="ETH"
(391 real changes made)

. replace ccode=531 if sanctioned_state_iso3=="ERI"
(2,309 real changes made)

. replace ccode=540 if sanctioned_state_iso3=="AGO"
(1,857 real changes made)

. replace ccode=541 if sanctioned_state_iso3=="MOZ"
(0 real changes made)

. replace ccode=551 if sanctioned_state_iso3=="ZMB"
(0 real changes made)

. replace ccode=552 if sanctioned_state_iso3=="ZWE"
(932 real changes made)

. replace ccode=552 if sanctioned_state_iso3=="RHO"
(1,926 real changes made)

. replace ccode=553 if sanctioned_state_iso3=="MWI"
(0 real changes made)

. replace ccode=560 if sanctioned_state_iso3=="ZAF"
(4,711 real changes made)

. replace ccode=565 if sanctioned_state_iso3=="NAM"
(0 real changes made)

. replace ccode=570 if sanctioned_state_iso3=="LSO"
(2 real changes made)

. replace ccode=571 if sanctioned_state_iso3=="BWA"
(0 real changes made)

. replace ccode=572 if sanctioned_state_iso3=="SWZ"
(0 real changes made)

. replace ccode=580 if sanctioned_state_iso3=="MDG"
(0 real changes made)

. replace ccode=581 if sanctioned_state_iso3=="COM"
(0 real changes made)

. replace ccode=590 if sanctioned_state_iso3=="MUS"
(0 real changes made)

. replace ccode=591 if sanctioned_state_iso3=="SYC"
(0 real changes made)

. replace ccode=600 if sanctioned_state_iso3=="MAR"
(0 real changes made)

. replace ccode=615 if sanctioned_state_iso3=="DZA"
(11 real changes made)

. replace ccode=616 if sanctioned_state_iso3=="TUN"
(0 real changes made)

. replace ccode=620 if sanctioned_state_iso3=="LBY"
(4,825 real changes made)

. replace ccode=625 if sanctioned_state_iso3=="SDN"
(4,092 real changes made)

. replace ccode=626 if sanctioned_state_iso3=="SSD"
(1,411 real changes made)

. replace ccode=630 if sanctioned_state_iso3=="IRN"
(3,283 real changes made)

. replace ccode=640 if sanctioned_state_iso3=="TUR"
(9 real changes made)

. replace ccode=645 if sanctioned_state_iso3=="IRQ"
(6,374 real changes made)

. replace ccode=651 if sanctioned_state_iso3=="EGY"
(428 real changes made)

. replace ccode=652 if sanctioned_state_iso3=="SYR"
(875 real changes made)

. replace ccode=660 if sanctioned_state_iso3=="LBN"
(3,460 real changes made)

. replace ccode=663 if sanctioned_state_iso3=="JOR"
(8 real changes made)

. replace ccode=666 if sanctioned_state_iso3=="ISR"
(75 real changes made)

. replace ccode=670 if sanctioned_state_iso3=="SAU"
(5 real changes made)

. replace ccode=678 if sanctioned_state_iso3=="YEM" & year < 1990 //north yemen
(0 real changes made)

. replace ccode=679 if sanctioned_state_iso3=="YEM" & year >= 1990 //current yemen
(1,728 real changes made)

. replace ccode=680 if sanctioned_state_iso3=="YMD" //south yemen
(0 real changes made)

. replace ccode=690 if sanctioned_state_iso3=="KWT"
(326 real changes made)

. replace ccode=692 if sanctioned_state_iso3=="BHR"
(0 real changes made)

. replace ccode=694 if sanctioned_state_iso3=="QAT"
(0 real changes made)

. replace ccode=696 if sanctioned_state_iso3=="ARE"
(1 real change made)

. replace ccode=698 if sanctioned_state_iso3=="OMN"
(0 real changes made)

. replace ccode=700 if sanctioned_state_iso3=="AFG"
(5,339 real changes made)

. replace ccode=701 if sanctioned_state_iso3=="TKM"
(0 real changes made)

. replace ccode=702 if sanctioned_state_iso3=="TJK"
(0 real changes made)

. replace ccode=703 if sanctioned_state_iso3=="KGZ"
(0 real changes made)

. replace ccode=704 if sanctioned_state_iso3=="UZB"
(135 real changes made)

. replace ccode=705 if sanctioned_state_iso3=="KAZ"
(0 real changes made)

. replace ccode=710 if sanctioned_state_iso3=="CHN"
(967 real changes made)

. replace ccode=712 if sanctioned_state_iso3=="MNG"
(0 real changes made)

. replace ccode=713 if sanctioned_state_iso3=="TWN"
(0 real changes made)

. replace ccode=731 if sanctioned_state_iso3=="PRK" //N KOREA
(11,178 real changes made)

. replace ccode=732 if sanctioned_state_iso3=="KOR" //S KOREA
(0 real changes made)

. replace ccode=740 if sanctioned_state_iso3=="JPN"
(0 real changes made)

. replace ccode=750 if sanctioned_state_iso3=="IND"
(1,422 real changes made)

. replace ccode=760 if sanctioned_state_iso3=="BTN"
(0 real changes made)

. replace ccode=770 if sanctioned_state_iso3=="PAK"
(1,450 real changes made)

. replace ccode=771 if sanctioned_state_iso3=="BGD"
(0 real changes made)

. replace ccode=775 if sanctioned_state_iso3=="MMR"
(1,111 real changes made)

. replace ccode=780 if sanctioned_state_iso3=="LKA"
(0 real changes made)

. replace ccode=781 if sanctioned_state_iso3=="MDV"
(0 real changes made)

. replace ccode=790 if sanctioned_state_iso3=="NPL"
(7 real changes made)

. replace ccode=800 if sanctioned_state_iso3=="THA"
(0 real changes made)

. replace ccode=811 if sanctioned_state_iso3=="KHM"
(27 real changes made)

. replace ccode=812 if sanctioned_state_iso3=="LAO"
(0 real changes made)

. replace ccode=816 if sanctioned_state_iso3=="VDR"
(0 real changes made)

. replace ccode=816 if sanctioned_state_iso3=="VNM"
(10 real changes made)

. replace ccode=820 if sanctioned_state_iso3=="MYS"
(0 real changes made)

. replace ccode=830 if sanctioned_state_iso3=="SGP"
(0 real changes made)

. replace ccode=835 if sanctioned_state_iso3=="BRN"
(0 real changes made)

. replace ccode=840 if sanctioned_state_iso3=="PHL"
(0 real changes made)

. replace ccode=850 if sanctioned_state_iso3=="IDN"
(44 real changes made)

. replace ccode=860 if sanctioned_state_iso3=="TLS"
(0 real changes made)

. replace ccode=860 if sanctioned_state_iso3=="TMP"
(0 real changes made)

. replace ccode=900 if sanctioned_state_iso3=="AUS"
(0 real changes made)

. replace ccode=910 if sanctioned_state_iso3=="PNG"
(0 real changes made)

. replace ccode=920 if sanctioned_state_iso3=="NZL"
(0 real changes made)

. replace ccode=935 if sanctioned_state_iso3=="VUT"
(0 real changes made)

. replace ccode=940 if sanctioned_state_iso3=="SLB"
(0 real changes made)

. replace ccode=946 if sanctioned_state_iso3=="KIR"
(0 real changes made)

. replace ccode=947 if sanctioned_state_iso3=="TUV"
(0 real changes made)

. replace ccode=950 if sanctioned_state_iso3=="FJI"
(23 real changes made)

. replace ccode=955 if sanctioned_state_iso3=="TON"
(0 real changes made)

. replace ccode=970 if sanctioned_state_iso3=="NRU"
(0 real changes made)

. replace ccode=983 if sanctioned_state_iso3=="MHL"
(0 real changes made)

. replace ccode=986 if sanctioned_state_iso3=="PLW"
(0 real changes made)

. replace ccode=987 if sanctioned_state_iso3=="FSM"
(0 real changes made)

. replace ccode=990 if sanctioned_state_iso3=="WSM"
(0 real changes made)

. 
end of do-file

. 
. drop if missing(ccode)
(2 observations deleted)

. drop sanctioned_state_iso3

. 
. sort ccode year

. 
. duplicates drop ccode year, force

Duplicates in terms of ccode year

(108,699 observations deleted)

. drop if (year<1989 | year>=2020)
(569 observations deleted)

. //drop if year<1989
. 
. save "temps/gsdb_arms.dta", replace
file temps/gsdb_arms.dta saved

. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. use "temps/sipri_coll_self_bd_c1.dta"

. 
. merge 1:1 ccode year using temps/gsdb_arms.dta

    Result                      Number of obs
    -----------------------------------------
    Not matched                         3,619
        from master                     3,510  (_merge==1)
        from using                        109  (_merge==2)

    Matched                             1,030  (_merge==3)
    -----------------------------------------

. 
. /*
> 1 = no arms sanctions
> 2 = islands and coding clashes
> 3 = match
> */
. 
. drop if _merge == 2
(109 observations deleted)

. drop _merge

. 
. save "temps/sipri_gsdb.dta", replace
file temps/sipri_gsdb.dta saved

. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. use "temps/sipri_gsdb.dta"

. 
. **# YEAR OF CONFLICT
. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. use "originals/UcdpPrioConflict_v24_1.dta" 

. 
. destring type_of_conflict, replace
type_of_conflict: all characters numeric; replaced as byte

. keep if type_of_conflict == 3
(724 observations deleted)

. 
. destring year, replace
year: all characters numeric; replaced as int

. drop if (year<1989 | year>=2019)
(980 observations deleted)

. 
. rename gwno_loc ccode

. destring ccode, replace
ccode: all characters numeric; replaced as int

. replace ccode = 679 if ccode == 678 & year > 1990
(3 real changes made)

. 
. drop type_of_conflict

. 
. gen eventdate = date(start_date2, "YMD")

. format eventdate %td

. gen startyr = year(eventdate)

. gen duration = year + 1 - startyr

. 
. order ccode year

. sort ccode year

. 
. keep ccode year conflict_id location region startyr duration

. 
. collapse (max) duration, by(ccode year)

. 
. gen lnDuration = ln(duration)

. 
. save "temps/durations.dta", replace
file temps/durations.dta saved

. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. use "temps/sipri_gsdb.dta"

. 
. merge 1:1 ccode year using temps/durations.dta

    Result                      Number of obs
    -----------------------------------------
    Not matched                         3,943
        from master                     3,888  (_merge==1)
        from using                         55  (_merge==2)

    Matched                               652  (_merge==3)
    -----------------------------------------

. 
. drop if _merge == 2
(55 observations deleted)

. drop _merge

. 
. save "temps/sipri_gsdb_dur.dta", replace
file temps/sipri_gsdb_dur.dta saved

. 
. **# VDEM
. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. use "originals/vdem.dta"
(V-Dem CY-Full+Others)

. 
. keep country_name country_text_id year COWcode v2x_polyarchy e_polity2 e_gdppc e_regionpol_6C e_pelifeex v2xed_ed_inpt

. 
. drop if (year<1989 | year>=2019)
(22,625 observations deleted)

. 
. replace COWcode = 511 if country_text_id == "ZZB" //zanzibar. don't know why its COW code was missing
(30 real changes made)

. 
. drop if missing(COWcode)
(100 observations deleted)

. 
. rename COWcode ccode

. 
. save "temps/vdem_mod.dta", replace
file temps/vdem_mod.dta saved

. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. use "temps/sipri_gsdb_dur.dta"

. 
. merge 1:1 ccode year using temps/vdem_mod.dta
(variable year was int, now double to accommodate using data's values)
(variable ccode was float, now double to accommodate using data's values)

    Result                      Number of obs
    -----------------------------------------
    Not matched                         1,072
        from master                       212  (_merge==1)
        from using                        860  (_merge==2)

    Matched                             4,328  (_merge==3)
    -----------------------------------------

. 
. drop if _merge == 2
(860 observations deleted)

. drop _merge

. 
. gen lngdppc_v = ln(e_gdppc)
(212 missing values generated)

. 
. drop if year >= 2019
(151 observations deleted)

. 
. replace arms = 0 if missing(arms)
(3,399 real changes made)

. 
. save "temps/c1.dta", replace
file temps/c1.dta saved

. 
. **# ETHNIC FRACTIONALIZATION
. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. 
. * Convert .csv to .dta
. import delimited "originals/epr.csv"
(encoding automatically selected: ISO-8859-1)
(24 vars, 10,665 obs)

. keep countries_gwid year lexclpop

. drop if year < 1989
(5,211 observations deleted)

. drop if year > 2018
(348 observations deleted)

. rename countries_gwid ccode

. replace ccode = 679 if ccode == 678 & year > 1990 // yemen
(28 real changes made)

. replace ccode = 255 if ccode == 260 & year > 1990 // germany
(28 real changes made)

. replace ccode = 345 if ccode == 340 & year > 2006 // serbia
(12 real changes made)

. save "originals/eprgrow.dta", replace
file originals/eprgrow.dta saved

. // Marginalised Ethnic Group (MEG) population as a fraction of ethnically relevant population in this country (exclpo / lpop)
. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. use "temps/c1.dta"

. 
. merge 1:1 ccode year using originals/eprgrow.dta

    Result                      Number of obs
    -----------------------------------------
    Not matched                           717
        from master                         0  (_merge==1)
        from using                        717  (_merge==2)

    Matched                             4,389  (_merge==3)
    -----------------------------------------

. 
. drop if _merge == 2
(717 observations deleted)

. drop country_text_id v2x_polyarchy v2xed_ed_inpt e_pelifeex e_gdppc e_regionpol_6C lngdppc_v _merge

. 
. rename duration year_of_conflict

. rename lncollective_TIV ln_neigh_MCW

. rename lnself_TIV ln_conflict_MCW

. rename lnbd_best ln_BR_deaths

. rename e_polity2 polity

. rename lnpop ln_population

. rename lexclpop ethnic

. rename lngdppc ln_GDP_pc

. rename arms arms_sanctioned

. 
. label var ln_BR_deaths "ln(Battle-Related Deaths)"

. label var ln_neigh_MCW "ln(Neighbours' MCW Imports)"

. label var ln_conflict_MCW "ln(Conflict Country MCW Imports)"

. label var ln_population "ln(Population)"

. label var ln_GDP_pc "ln(GDP per capita)"

. label var arms_sanctioned "Arms Sanction"

. label var year_of_conflict "Year of Conflict"

. label var polity "Polity IV"

. label var ethnic "Ethnic Fractionalisation"

. 
. save "temps/c3.dta", replace
file temps/c3.dta saved

. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. use "temps/c3.dta"

. 
. xtset ccode year, yearly

Panel variable: ccode (unbalanced)
 Time variable: year, 1989 to 2018
         Delta: 1 year

. 
. gen lastyear = 0 if missing(l.ln_BR_deaths)
(632 missing values generated)

. replace lastyear = 1 if missing(lastyear)
(632 real changes made)

. label var lastyear "BR-deaths Present in Prev. Year"

. 
. drop if year > 2018
(0 observations deleted)

. 
. save "temps/c4.dta", replace
file temps/c4.dta saved

. 
. ****************************************************************
. 
. *******************     PAMP (2018) SPEC     *******************
. 
. ****************************************************************
. 
. **# FILTERED SIPRI DATA ACCORDING TO PAMP (2018) FOR ROBUSTNESS CHECK
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. 
. * Convert .csv to .dta
. import delimited "originals/filteredTIV.csv"
(encoding automatically selected: ISO-8859-1)
(3 vars, 16,000 obs)

. save "originals/sipri_filtered.dta", replace
file originals/sipri_filtered.dta saved

. 
. gen ccode=.
(16,000 missing values generated)

. order ccode

. 
. rename deliveryyear year

. 
. do "stata/texttocow.do" //Adding in COW country codes

. ***** TEXT TO CORRELATES OF WAR CODES *****
. * Derived from the work of Andreas Beger (2006) - https://www.andybeger.com/blog/2013-09-05-stata-do-files-for-country-code-conversions/
. 
. replace ccode=  2 if recipient=="United States of America"
(0 real changes made)

. replace ccode=  2 if recipient=="United States"
(319 real changes made)

. replace ccode=  2 if recipient=="USA"
(0 real changes made)

. replace ccode= 20 if recipient=="Canada"
(178 real changes made)

. replace ccode= 31 if recipient=="Bahamas"
(5 real changes made)

. replace ccode= 31 if recipient=="Bahamas, The"
(0 real changes made)

. replace ccode= 40 if recipient=="Cuba"
(16 real changes made)

. replace ccode= 41 if recipient=="Haiti"
(0 real changes made)

. replace ccode= 42 if recipient=="Dominican Republic"
(19 real changes made)

. replace ccode= 51 if recipient=="Jamaica"
(17 real changes made)

. replace ccode= 52 if recipient=="Trinidad and Tobago"
(5 real changes made)

. replace ccode= 52 if recipient=="Trinidad & Tobago"
(0 real changes made)

. replace ccode= 52 if recipient=="Trinidad &Tobago"
(0 real changes made)

. replace ccode= 53 if recipient=="Barbados"
(0 real changes made)

. replace ccode= 54 if recipient=="Dominica"
(0 real changes made)

. replace ccode= 55 if recipient=="Grenada"
(0 real changes made)

. replace ccode= 56 if recipient=="St. Lucia"
(0 real changes made)

. replace ccode= 57 if recipient=="St. Vincent and the Grenadines"
(0 real changes made)

. replace ccode= 57 if recipient=="St. Vincent & Grens."
(0 real changes made)

. replace ccode= 57 if recipient=="St. Vincent & Grenadines"
(0 real changes made)

. replace ccode= 57 if recipient=="St.Vincent & Grenadines"
(0 real changes made)

. replace ccode= 57 if recipient=="Saint Vincent"
(0 real changes made)

. replace ccode= 58 if recipient=="Antigua & Barbuda"
(0 real changes made)

. replace ccode= 58 if recipient=="Antigua and Barbuda"
(0 real changes made)

. replace ccode= 58 if recipient=="Antigua"
(0 real changes made)

. replace ccode= 60 if recipient=="St. Kitts and Nevis"
(0 real changes made)

. replace ccode= 60 if recipient=="St. Kitts & Nevis"
(0 real changes made)

. replace ccode= 60 if recipient=="Saint Kitts and Nevis"
(0 real changes made)

. replace ccode= 60 if recipient=="Saint Kitts & Nevis"
(0 real changes made)

. replace ccode= 60 if recipient=="Saint Kitts"
(0 real changes made)

. replace ccode= 70 if recipient=="Mexico"
(168 real changes made)

. replace ccode= 80 if recipient=="Belize"
(4 real changes made)

. replace ccode= 90 if recipient=="Guatemala"
(11 real changes made)

. replace ccode= 91 if recipient=="Honduras"
(8 real changes made)

. replace ccode= 92 if recipient=="El Salvador"
(22 real changes made)

. replace ccode= 93 if recipient=="Nicaragua"
(12 real changes made)

. replace ccode= 94 if recipient=="Costa Rica"
(2 real changes made)

. replace ccode= 95 if recipient=="Panama"
(1 real change made)

. replace ccode=100 if recipient=="Colombia"
(203 real changes made)

. replace ccode=101 if recipient=="Venezuela"
(161 real changes made)

. replace ccode=101 if recipient=="Venezuela, Rep. Bol."
(0 real changes made)

. replace ccode=110 if recipient=="Guyana"
(3 real changes made)

. replace ccode=115 if recipient=="Suriname"
(4 real changes made)

. replace ccode=130 if recipient=="Ecuador"
(62 real changes made)

. replace ccode=135 if recipient=="Peru"
(125 real changes made)

. replace ccode=140 if recipient=="Brazil"
(212 real changes made)

. replace ccode=145 if recipient=="Bolivia"
(46 real changes made)

. replace ccode=150 if recipient=="Paraguay"
(13 real changes made)

. replace ccode=155 if recipient=="Chile"
(238 real changes made)

. replace ccode=160 if recipient=="Argentina"
(91 real changes made)

. replace ccode=165 if recipient=="Uruguay"
(51 real changes made)

. replace ccode=200 if recipient=="United Kingdom"
(262 real changes made)

. replace ccode=205 if recipient=="Ireland"
(24 real changes made)

. replace ccode=210 if recipient=="Netherlands"
(190 real changes made)

. replace ccode=211 if recipient=="Belgium"
(83 real changes made)

. replace ccode=212 if recipient=="Luxembourg"
(5 real changes made)

. replace ccode=220 if recipient=="France"
(105 real changes made)

. replace ccode=221 if recipient=="Monaco"
(0 real changes made)

. replace ccode=223 if recipient=="Liechtenstein"
(0 real changes made)

. replace ccode=225 if recipient=="Switzerland"
(66 real changes made)

. replace ccode=230 if recipient=="Spain"
(234 real changes made)

. replace ccode=232 if recipient=="Andorra"
(0 real changes made)

. replace ccode=235 if recipient=="Portugal"
(98 real changes made)

. replace ccode=255 if recipient=="Germany"
(138 real changes made)

. replace ccode=260 if recipient=="German Federal Republic"
(0 real changes made)

. replace ccode=265 if recipient=="German Democratic Republic"
(0 real changes made)

. replace ccode=265 if recipient=="East Germany (GDR)"
(25 real changes made)

. replace ccode=290 if recipient=="Poland"
(188 real changes made)

. replace ccode=305 if recipient=="Austria"
(51 real changes made)

. replace ccode=310 if recipient=="Hungary"
(45 real changes made)

. replace ccode=315 if recipient=="Czechoslovakia"
(34 real changes made)

. replace ccode=316 if recipient=="Czech Republic"
(0 real changes made)

. replace ccode=316 if recipient=="Czechia"
(44 real changes made)

. replace ccode=317 if recipient=="Slovakia"
(26 real changes made)

. replace ccode=317 if recipient=="Slovak Republic"
(0 real changes made)

. replace ccode=325 if recipient=="Italy"
(202 real changes made)

. replace ccode=331 if recipient=="San Marino"
(0 real changes made)

. replace ccode=338 if recipient=="Malta"
(13 real changes made)

. replace ccode=339 if recipient=="Albania"
(13 real changes made)

. replace ccode=341 if recipient=="Montenegro"
(3 real changes made)

. replace ccode=343 if recipient=="Macedonia"
(0 real changes made)

. replace ccode=343 if recipient=="North Macedonia"
(31 real changes made)

. replace ccode=344 if recipient=="Croatia"
(38 real changes made)

. replace ccode=345 if recipient=="Yugoslavia"
(21 real changes made)

. replace ccode=345 if recipient=="Serbia and Montenegro"
(0 real changes made)

. replace ccode=345 if recipient=="Serbia"
(30 real changes made)

. replace ccode=346 if recipient=="Bosnia and Herzegovina"
(0 real changes made)

. replace ccode=346 if recipient=="Bosnia-Herzegovina"
(21 real changes made)

. replace ccode=347 if recipient=="Kosovo"
(2 real changes made)

. replace ccode=349 if recipient=="Slovenia"
(37 real changes made)

. replace ccode=350 if recipient=="Greece"
(320 real changes made)

. replace ccode=352 if recipient=="Cyprus"
(52 real changes made)

. replace ccode=355 if recipient=="Bulgaria"
(66 real changes made)

. replace ccode=359 if recipient=="Moldova"
(5 real changes made)

. replace ccode=360 if recipient=="Romania"
(111 real changes made)

. replace ccode=365 if recipient=="Russia"
(29 real changes made)

. replace ccode=365 if recipient=="Soviet Union"
(14 real changes made)

. replace ccode=365 if recipient=="USSR"
(0 real changes made)

. replace ccode=366 if recipient=="Estonia"
(49 real changes made)

. replace ccode=367 if recipient=="Latvia"
(40 real changes made)

. replace ccode=368 if recipient=="Lithuania"
(48 real changes made)

. replace ccode=369 if recipient=="Ukraine"
(13 real changes made)

. replace ccode=370 if recipient=="Belarus"
(23 real changes made)

. replace ccode=371 if recipient=="Armenia"
(47 real changes made)

. replace ccode=372 if recipient=="Georgia"
(63 real changes made)

. replace ccode=373 if recipient=="Azerbaijan"
(186 real changes made)

. replace ccode=375 if recipient=="Finland"
(152 real changes made)

. replace ccode=380 if recipient=="Sweden"
(95 real changes made)

. replace ccode=385 if recipient=="Norway"
(143 real changes made)

. replace ccode=390 if recipient=="Denmark"
(108 real changes made)

. replace ccode=390 if recipient=="Denmark"
(0 real changes made)

. replace ccode=395 if recipient=="Iceland"
(0 real changes made)

. replace ccode=402 if recipient=="Cape Verde"
(0 real changes made)

. replace ccode=402 if recipient=="Cabo Verde"
(4 real changes made)

. replace ccode=403 if recipient=="Sao Tome and Principe"
(0 real changes made)

. replace ccode=404 if recipient=="Guinea-Bissau"
(0 real changes made)

. replace ccode=411 if recipient=="Equatorial Guinea"
(18 real changes made)

. replace ccode=420 if recipient=="Gambia"
(1 real change made)

. replace ccode=420 if recipient=="Gambia, The"
(0 real changes made)

. replace ccode=432 if recipient=="Mali"
(36 real changes made)

. replace ccode=433 if recipient=="Senegal"
(45 real changes made)

. replace ccode=434 if recipient=="Benin"
(10 real changes made)

. replace ccode=435 if recipient=="Mauritania"
(24 real changes made)

. replace ccode=436 if recipient=="Niger"
(17 real changes made)

. replace ccode=437 if recipient=="Ivory Coast"
(0 real changes made)

. replace ccode=437 if recipient=="Côte d'Ivoire"
(0 real changes made)

. replace ccode=437 if recipient=="Cote d'Ivoire"
(34 real changes made)

. replace ccode=437 if recipient=="Cote d`Ivoire"
(0 real changes made)

. replace ccode=438 if recipient=="Guinea"
(21 real changes made)

. replace ccode=439 if recipient=="Burkina Faso"
(23 real changes made)

. replace ccode=450 if recipient=="Liberia"
(4 real changes made)

. replace ccode=451 if recipient=="Sierra Leone"
(15 real changes made)

. replace ccode=452 if recipient=="Ghana"
(42 real changes made)

. replace ccode=461 if recipient=="Togo"
(8 real changes made)

. replace ccode=471 if recipient=="Cameroon"
(45 real changes made)

. replace ccode=475 if recipient=="Nigeria"
(105 real changes made)

. replace ccode=481 if recipient=="Gabon"
(17 real changes made)

. replace ccode=482 if recipient=="Central African Republic"
(5 real changes made)

. replace ccode=482 if recipient=="Central African Rep."
(0 real changes made)

. replace ccode=482 if recipient=="Central African Rep"
(0 real changes made)

. replace ccode=483 if recipient=="Chad"
(51 real changes made)

. replace ccode=484 if recipient=="Congo"
(36 real changes made)

. replace ccode=484 if recipient=="Congo, Republic of the"
(0 real changes made)

. replace ccode=484 if recipient=="Congo, Republic of"
(0 real changes made)

. replace ccode=484 if recipient=="Congo, Rep."
(0 real changes made)

. replace ccode=484 if recipient=="Congo, Rep"
(0 real changes made)

. replace ccode=484 if recipient=="Congo-Brazzaville"
(0 real changes made)

. replace ccode=484 if recipient=="Congo, Brazzaville"
(0 real changes made)

. replace ccode=490 if recipient=="Democratic Republic of the Congo"
(0 real changes made)

. replace ccode=490 if recipient=="Democratic Republic of Congo"
(0 real changes made)

. replace ccode=490 if recipient=="Congo, Democratic Republic of the"
(0 real changes made)

. replace ccode=490 if recipient=="Congo, Democratic Republic"
(0 real changes made)

. replace ccode=490 if recipient=="Congo, Dem. Rep. of"
(0 real changes made)

. replace ccode=490 if recipient=="Congo, Dem. Rep."
(0 real changes made)

. replace ccode=490 if recipient=="Congo-Kinshasa"
(0 real changes made)

. replace ccode=490 if recipient=="Congo, DR"
(0 real changes made)

. replace ccode=490 if recipient=="DR Congo"
(43 real changes made)

. replace ccode=490 if recipient=="Zaire"
(0 real changes made)

. replace ccode=500 if recipient=="Uganda"
(71 real changes made)

. replace ccode=501 if recipient=="Kenya"
(33 real changes made)

. replace ccode=510 if recipient=="Tanzania"
(30 real changes made)

. replace ccode=511 if recipient=="Zanzibar"
(0 real changes made)

. replace ccode=516 if recipient=="Burundi"
(10 real changes made)

. replace ccode=517 if recipient=="Rwanda"
(30 real changes made)

. replace ccode=520 if recipient=="Somalia"
(13 real changes made)

. replace ccode=522 if recipient=="Djibouti"
(21 real changes made)

. replace ccode=530 if recipient=="Ethiopia"
(62 real changes made)

. replace ccode=531 if recipient=="Eritrea"
(30 real changes made)

. replace ccode=540 if recipient=="Angola"
(141 real changes made)

. replace ccode=541 if recipient=="Mozambique"
(15 real changes made)

. replace ccode=551 if recipient=="Zambia"
(28 real changes made)

. replace ccode=552 if recipient=="Zimbabwe"
(19 real changes made)

. replace ccode=553 if recipient=="Malawi"
(14 real changes made)

. replace ccode=560 if recipient=="South Africa"
(44 real changes made)

. replace ccode=565 if recipient=="Namibia"
(22 real changes made)

. replace ccode=570 if recipient=="Lesotho"
(11 real changes made)

. replace ccode=571 if recipient=="Botswana"
(40 real changes made)

. replace ccode=572 if recipient=="Swaziland"
(0 real changes made)

. replace ccode=572 if recipient=="eSwatini"
(2 real changes made)

. replace ccode=580 if recipient=="Madagascar"
(2 real changes made)

. replace ccode=581 if recipient=="Comoros"
(2 real changes made)

. replace ccode=590 if recipient=="Mauritius"
(5 real changes made)

. replace ccode=591 if recipient=="Seychelles"
(4 real changes made)

. replace ccode=600 if recipient=="Morocco"
(101 real changes made)

. replace ccode=615 if recipient=="Algeria"
(228 real changes made)

. replace ccode=616 if recipient=="Tunisia"
(48 real changes made)

. replace ccode=620 if recipient=="Libya"
(30 real changes made)

. replace ccode=625 if recipient=="Sudan"
(152 real changes made)

. replace ccode=626 if recipient=="South Sudan"
(17 real changes made)

. replace ccode=630 if recipient=="Iran"
(291 real changes made)

. replace ccode=630 if recipient=="Iran, Islamic Republic"
(0 real changes made)

. replace ccode=630 if recipient=="Iran, Ismalic Rep."
(0 real changes made)

. replace ccode=630 if recipient=="Iran, Ismalic Rep"
(0 real changes made)

. replace ccode=640 if recipient=="Turkey"
(0 real changes made)

. replace ccode=640 if recipient=="Turkiye"
(433 real changes made)

. replace ccode=645 if recipient=="Iraq"
(294 real changes made)

. replace ccode=651 if recipient=="Egypt"
(396 real changes made)

. replace ccode=651 if recipient=="Egypt, Arab Republic"
(0 real changes made)

. replace ccode=651 if recipient=="Egypt, Arab Rep."
(0 real changes made)

. replace ccode=652 if recipient=="Syria"
(109 real changes made)

. replace ccode=652 if recipient=="Syrian Arab Republic"
(0 real changes made)

. replace ccode=660 if recipient=="Lebanon"
(68 real changes made)

. replace ccode=663 if recipient=="Jordan"
(183 real changes made)

. replace ccode=666 if recipient=="Israel"
(182 real changes made)

. replace ccode=670 if recipient=="Saudi Arabia"
(460 real changes made)

. replace ccode=678 if recipient=="Yemen Arab Republic"
(0 real changes made)

. replace ccode=678 if recipient=="Yemen Arab Republic (North Yemen)"
(0 real changes made)

. replace ccode=678 if recipient=="North Yemen"
(0 real changes made)

. replace ccode=679 if recipient=="Yemen"
(75 real changes made)

. replace ccode=679 if recipient=="Yemen, Rep."
(0 real changes made)

. replace ccode=679 if recipient=="Yemen, Republic of"
(0 real changes made)

. replace ccode=680 if recipient=="Yemen People's Republic"
(0 real changes made)

. replace ccode=680 if recipient=="Yemen PDR"
(0 real changes made)

. replace ccode=680 if recipient=="South Yemen"
(1 real change made)

. replace ccode=690 if recipient=="Kuwait"
(134 real changes made)

. replace ccode=692 if recipient=="Bahrain"
(89 real changes made)

. replace ccode=694 if recipient=="Qatar"
(83 real changes made)

. replace ccode=696 if recipient=="United Arab Emirates"
(0 real changes made)

. replace ccode=696 if recipient=="UAE"
(402 real changes made)

. replace ccode=698 if recipient=="Oman"
(111 real changes made)

. replace ccode=700 if recipient=="Afghanistan"
(132 real changes made)

. replace ccode=701 if recipient=="Turkmenistan"
(50 real changes made)

. replace ccode=702 if recipient=="Tajikistan"
(17 real changes made)

. replace ccode=703 if recipient=="Kyrgyzstan"
(10 real changes made)

. replace ccode=703 if recipient=="Kyrgyz Republic"
(0 real changes made)

. replace ccode=704 if recipient=="Uzbekistan"
(18 real changes made)

. replace ccode=705 if recipient=="Kazakhstan"
(106 real changes made)

. replace ccode=710 if recipient=="China"
(304 real changes made)

. replace ccode=710 if recipient=="China, People's Republic"
(0 real changes made)

. replace ccode=710 if recipient=="China, People's Rep."
(0 real changes made)

. replace ccode=710 if recipient=="China, People's Rep"
(0 real changes made)

. replace ccode=710 if recipient=="China, PRC"
(0 real changes made)

. replace ccode=710 if recipient=="China,P.R.: Mainland"
(0 real changes made)

. replace ccode=712 if recipient=="Mongolia"
(7 real changes made)

. replace ccode=713 if recipient=="Taiwan"
(187 real changes made)

. replace ccode=713 if recipient=="Taiwan, China"
(0 real changes made)

. replace ccode=730 if recipient=="Korea"
(0 real changes made)

. replace ccode=731 if recipient=="North Korea"
(99 real changes made)

. replace ccode=731 if recipient=="Korea, Democratic Republic"
(0 real changes made)

. replace ccode=731 if recipient=="Democratic People's Republic of Korea"
(0 real changes made)

. replace ccode=731 if recipient=="Korea, Dem. Rep."
(0 real changes made)

. replace ccode=732 if recipient=="South Korea"
(353 real changes made)

. replace ccode=732 if recipient=="Korea"
(0 real changes made)

. replace ccode=732 if recipient=="Korea, Republic of"
(0 real changes made)

. replace ccode=732 if recipient=="Republic of Korea"
(0 real changes made)

. replace ccode=732 if recipient=="Korea, Rep."
(0 real changes made)

. replace ccode=740 if recipient=="Japan"
(477 real changes made)

. replace ccode=750 if recipient=="India"
(718 real changes made)

. replace ccode=760 if recipient=="Bhutan"
(3 real changes made)

. replace ccode=770 if recipient=="Pakistan"
(528 real changes made)

. replace ccode=771 if recipient=="Bangladesh"
(126 real changes made)

. replace ccode=775 if recipient=="Myanmar"
(169 real changes made)

. replace ccode=780 if recipient=="Sri Lanka"
(98 real changes made)

. replace ccode=781 if recipient=="Maldives"
(5 real changes made)

. replace ccode=790 if recipient=="Nepal"
(30 real changes made)

. replace ccode=800 if recipient=="Thailand"
(275 real changes made)

. replace ccode=811 if recipient=="Cambodia"
(44 real changes made)

. replace ccode=812 if recipient=="Laos"
(28 real changes made)

. replace ccode=812 if recipient=="Lao People's Dem.Rep"
(0 real changes made)

. replace ccode=816 if recipient=="Vietnam"
(0 real changes made)

. replace ccode=816 if recipient=="Viet Nam"
(143 real changes made)

. replace ccode=816 if recipient=="Viet Minh (France)*"
(0 real changes made)

. replace ccode=816 if recipient=="Democratic Republic of Vietnam"
(0 real changes made)

. replace ccode=817 if recipient=="Republic of Vietnam"
(0 real changes made)

. replace ccode=817 if recipient=="Vietnam, Republic of"
(0 real changes made)

. replace ccode=817 if recipient=="Viet Cong (South Vietnam)*"
(0 real changes made)

. replace ccode=817 if recipient=="South Vietnam"
(0 real changes made)

. replace ccode=820 if recipient=="Malaysia"
(167 real changes made)

. replace ccode=830 if recipient=="Singapore"
(222 real changes made)

. replace ccode=835 if recipient=="Brunei"
(17 real changes made)

. replace ccode=840 if recipient=="Philippines"
(92 real changes made)

. replace ccode=850 if recipient=="Indonesia"
(260 real changes made)

. replace ccode=860 if recipient=="East Timor"
(0 real changes made)

. replace ccode=860 if recipient=="Timor-Leste"
(0 real changes made)

. replace ccode=900 if recipient=="Australia"
(286 real changes made)

. replace ccode=910 if recipient=="Papua New Guinea"
(7 real changes made)

. replace ccode=920 if recipient=="New Zealand"
(44 real changes made)

. replace ccode=935 if recipient=="Vanuatu"
(0 real changes made)

. replace ccode=940 if recipient=="Solomon Islands"
(0 real changes made)

. replace ccode=946 if recipient=="Kiribati"
(0 real changes made)

. replace ccode=947 if recipient=="Tuvalu"
(0 real changes made)

. replace ccode=950 if recipient=="Fiji"
(3 real changes made)

. replace ccode=955 if recipient=="Tonga"
(1 real change made)

. replace ccode=970 if recipient=="Nauru"
(0 real changes made)

. replace ccode=983 if recipient=="Marshall Islands"
(0 real changes made)

. replace ccode=986 if recipient=="Palau"
(0 real changes made)

. replace ccode=987 if recipient=="Federated States of Micronesia"
(0 real changes made)

. replace ccode=987 if recipient=="Micronesia"
(0 real changes made)

. replace ccode=987 if recipient=="Micronesia, Fed. Sts."
(0 real changes made)

. replace ccode=990 if recipient=="Samoa"
(0 real changes made)

. 
end of do-file

. 
. drop if missing(ccode)
(245 observations deleted)

. 
. sort ccode year

. 
. collapse (sum) tivdeliveryvalues, by(ccode year)

. 
. save "originals/sipri_filtered_collapsed.dta", replace
file originals/sipri_filtered_collapsed.dta saved

. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. use "temps/c4.dta"

. 
. merge 1:1 ccode year using originals/sipri_filtered_collapsed.dta

    Result                      Number of obs
    -----------------------------------------
    Not matched                         1,972
        from master                     1,662  (_merge==1)
        from using                        310  (_merge==2)

    Matched                             2,727  (_merge==3)
    -----------------------------------------

. 
. drop if _merge == 2
(310 observations deleted)

. drop _merge lnDuration 

. drop if year > 2018
(0 observations deleted)

. 
. rename tivdeliveryvalues self_pampTIV

. 
. order ccode year ln_BR_deaths ln_neigh_MCW arms_sanctioned ln_conflict_MCW lastyear year_of_conflict ln_GDP_pc ln_population polity ethn
> ic self_pampTIV self_TIV

. 
. save "temps/c5_p1.dta", replace
file temps/c5_p1.dta saved

. 
. 
. **# MERGING CSHAPES AND NEIGHBOURS' SIPRI TIVs
. /*
> 1 = microstates (monaco, liechtenstein, andorra, and san marino) - not included in SIPRI??
> 2 = no neighbours, either due to no land border or country/data didn't exist in that year
> 3 = match
> */ 
. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. use "temps/cshapes_mod.dta"

. merge m:1 ccode year using originals/sipri_filtered_collapsed.dta
(variable ccode was int, now float to accommodate using data's values)

    Result                      Number of obs
    -----------------------------------------
    Not matched                         7,187
        from master                     6,877  (_merge==1)
        from using                        310  (_merge==2)

    Matched                            11,633  (_merge==3)
    -----------------------------------------

. 
. drop if (year<1989 | year>2018)
(624 observations deleted)

. keep if _merge == 3
(6,563 observations deleted)

. drop _merge

. 
. rename ccode neighbour

. rename tivdeliveryvalues neighbour_TIV

. 
. save "temps/cshapes_sipri_filtered.dta", replace
file temps/cshapes_sipri_filtered.dta saved

. 
. 
. **# GENERATING COLLECTIVE IMPORTS
. /*
> summing up a country's neighbours' TIVs for a particular year. this generates duplicates where the country has multiple neighbours, so d
> ropped the duplicate observations. neighbour ccodes are also no longer necessary as each instance of the referent country should have th
> e same collective TIV
> */
. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. use "temps/cshapes_sipri_filtered.dta"

. 
. egen collective_pampTIV = total(neighbour_TIV), by(referent year)

. 
. drop neighbour_TIV neighbour

. duplicates drop

Duplicates in terms of all variables

(7,438 observations deleted)

. 
. rename referent ccode

. sort ccode year

. 
. save "temps/sipri_coll_filtered.dta", replace
file temps/sipri_coll_filtered.dta saved

. 
. 
. **# MERGING COLLECTIVE INTO THE DATASET
. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. use "temps/c5_p1.dta"

. 
. merge 1:1 ccode year using temps/sipri_coll_filtered.dta

    Result                      Number of obs
    -----------------------------------------
    Not matched                           402
        from master                       298  (_merge==1)
        from using                        104  (_merge==2)

    Matched                             4,091  (_merge==3)
    -----------------------------------------

. 
. drop if _merge == 2
(104 observations deleted)

. drop _merge

. 
. order ccode year ln_BR_deaths ln_neigh_MCW arms_sanctioned ln_conflict_MCW lastyear year_of_conflict ln_GDP_pc ln_population polity ethn
> ic self_pampTIV self_TIV collective_pampTIV collective_TIV

. 
. replace self_pampTIV = self_pampTIV * 100
(2,727 real changes made)

. replace collective_pampTIV = collective_pampTIV * 100
(4,091 real changes made)

. 
. gen ln_neigh_PAMP = ln(collective_pampTIV)
(298 missing values generated)

. gen ln_conflict_PAMP = ln(self_pampTIV)
(1,662 missing values generated)

. 
. save "temps/c5_p2.dta", replace
file temps/c5_p2.dta saved

. 
. **************************************************************
. 
. *******************     PAMP-PLUS SPEC     *******************
. 
. **************************************************************
. 
. **# PAMP PLUS
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. 
. * Convert .csv to .dta
. import delimited "originals/filteredTIV_PAMPplus.csv"
(encoding automatically selected: ISO-8859-1)
(3 vars, 16,471 obs)

. save "originals/sipri_filtered_plus.dta", replace
file originals/sipri_filtered_plus.dta saved

. 
. gen ccode=.
(16,471 missing values generated)

. order ccode

. 
. rename deliveryyear year

. 
. do "stata/texttocow.do" //Adding in COW country codes

. ***** TEXT TO CORRELATES OF WAR CODES *****
. * Derived from the work of Andreas Beger (2006) - https://www.andybeger.com/blog/2013-09-05-stata-do-files-for-country-code-conversions/
. 
. replace ccode=  2 if recipient=="United States of America"
(0 real changes made)

. replace ccode=  2 if recipient=="United States"
(323 real changes made)

. replace ccode=  2 if recipient=="USA"
(0 real changes made)

. replace ccode= 20 if recipient=="Canada"
(185 real changes made)

. replace ccode= 31 if recipient=="Bahamas"
(5 real changes made)

. replace ccode= 31 if recipient=="Bahamas, The"
(0 real changes made)

. replace ccode= 40 if recipient=="Cuba"
(16 real changes made)

. replace ccode= 41 if recipient=="Haiti"
(0 real changes made)

. replace ccode= 42 if recipient=="Dominican Republic"
(19 real changes made)

. replace ccode= 51 if recipient=="Jamaica"
(17 real changes made)

. replace ccode= 52 if recipient=="Trinidad and Tobago"
(5 real changes made)

. replace ccode= 52 if recipient=="Trinidad & Tobago"
(0 real changes made)

. replace ccode= 52 if recipient=="Trinidad &Tobago"
(0 real changes made)

. replace ccode= 53 if recipient=="Barbados"
(0 real changes made)

. replace ccode= 54 if recipient=="Dominica"
(0 real changes made)

. replace ccode= 55 if recipient=="Grenada"
(0 real changes made)

. replace ccode= 56 if recipient=="St. Lucia"
(0 real changes made)

. replace ccode= 57 if recipient=="St. Vincent and the Grenadines"
(0 real changes made)

. replace ccode= 57 if recipient=="St. Vincent & Grens."
(0 real changes made)

. replace ccode= 57 if recipient=="St. Vincent & Grenadines"
(0 real changes made)

. replace ccode= 57 if recipient=="St.Vincent & Grenadines"
(0 real changes made)

. replace ccode= 57 if recipient=="Saint Vincent"
(0 real changes made)

. replace ccode= 58 if recipient=="Antigua & Barbuda"
(0 real changes made)

. replace ccode= 58 if recipient=="Antigua and Barbuda"
(0 real changes made)

. replace ccode= 58 if recipient=="Antigua"
(0 real changes made)

. replace ccode= 60 if recipient=="St. Kitts and Nevis"
(0 real changes made)

. replace ccode= 60 if recipient=="St. Kitts & Nevis"
(0 real changes made)

. replace ccode= 60 if recipient=="Saint Kitts and Nevis"
(0 real changes made)

. replace ccode= 60 if recipient=="Saint Kitts & Nevis"
(0 real changes made)

. replace ccode= 60 if recipient=="Saint Kitts"
(0 real changes made)

. replace ccode= 70 if recipient=="Mexico"
(168 real changes made)

. replace ccode= 80 if recipient=="Belize"
(4 real changes made)

. replace ccode= 90 if recipient=="Guatemala"
(11 real changes made)

. replace ccode= 91 if recipient=="Honduras"
(8 real changes made)

. replace ccode= 92 if recipient=="El Salvador"
(22 real changes made)

. replace ccode= 93 if recipient=="Nicaragua"
(12 real changes made)

. replace ccode= 94 if recipient=="Costa Rica"
(2 real changes made)

. replace ccode= 95 if recipient=="Panama"
(1 real change made)

. replace ccode=100 if recipient=="Colombia"
(203 real changes made)

. replace ccode=101 if recipient=="Venezuela"
(167 real changes made)

. replace ccode=101 if recipient=="Venezuela, Rep. Bol."
(0 real changes made)

. replace ccode=110 if recipient=="Guyana"
(3 real changes made)

. replace ccode=115 if recipient=="Suriname"
(4 real changes made)

. replace ccode=130 if recipient=="Ecuador"
(63 real changes made)

. replace ccode=135 if recipient=="Peru"
(125 real changes made)

. replace ccode=140 if recipient=="Brazil"
(215 real changes made)

. replace ccode=145 if recipient=="Bolivia"
(46 real changes made)

. replace ccode=150 if recipient=="Paraguay"
(13 real changes made)

. replace ccode=155 if recipient=="Chile"
(245 real changes made)

. replace ccode=160 if recipient=="Argentina"
(91 real changes made)

. replace ccode=165 if recipient=="Uruguay"
(51 real changes made)

. replace ccode=200 if recipient=="United Kingdom"
(264 real changes made)

. replace ccode=205 if recipient=="Ireland"
(24 real changes made)

. replace ccode=210 if recipient=="Netherlands"
(195 real changes made)

. replace ccode=211 if recipient=="Belgium"
(83 real changes made)

. replace ccode=212 if recipient=="Luxembourg"
(5 real changes made)

. replace ccode=220 if recipient=="France"
(105 real changes made)

. replace ccode=221 if recipient=="Monaco"
(0 real changes made)

. replace ccode=223 if recipient=="Liechtenstein"
(0 real changes made)

. replace ccode=225 if recipient=="Switzerland"
(66 real changes made)

. replace ccode=230 if recipient=="Spain"
(244 real changes made)

. replace ccode=232 if recipient=="Andorra"
(0 real changes made)

. replace ccode=235 if recipient=="Portugal"
(99 real changes made)

. replace ccode=255 if recipient=="Germany"
(149 real changes made)

. replace ccode=260 if recipient=="German Federal Republic"
(0 real changes made)

. replace ccode=265 if recipient=="German Democratic Republic"
(0 real changes made)

. replace ccode=265 if recipient=="East Germany (GDR)"
(26 real changes made)

. replace ccode=290 if recipient=="Poland"
(188 real changes made)

. replace ccode=305 if recipient=="Austria"
(51 real changes made)

. replace ccode=310 if recipient=="Hungary"
(45 real changes made)

. replace ccode=315 if recipient=="Czechoslovakia"
(38 real changes made)

. replace ccode=316 if recipient=="Czech Republic"
(0 real changes made)

. replace ccode=316 if recipient=="Czechia"
(44 real changes made)

. replace ccode=317 if recipient=="Slovakia"
(26 real changes made)

. replace ccode=317 if recipient=="Slovak Republic"
(0 real changes made)

. replace ccode=325 if recipient=="Italy"
(202 real changes made)

. replace ccode=331 if recipient=="San Marino"
(0 real changes made)

. replace ccode=338 if recipient=="Malta"
(13 real changes made)

. replace ccode=339 if recipient=="Albania"
(13 real changes made)

. replace ccode=341 if recipient=="Montenegro"
(3 real changes made)

. replace ccode=343 if recipient=="Macedonia"
(0 real changes made)

. replace ccode=343 if recipient=="North Macedonia"
(32 real changes made)

. replace ccode=344 if recipient=="Croatia"
(38 real changes made)

. replace ccode=345 if recipient=="Yugoslavia"
(23 real changes made)

. replace ccode=345 if recipient=="Serbia and Montenegro"
(0 real changes made)

. replace ccode=345 if recipient=="Serbia"
(31 real changes made)

. replace ccode=346 if recipient=="Bosnia and Herzegovina"
(0 real changes made)

. replace ccode=346 if recipient=="Bosnia-Herzegovina"
(21 real changes made)

. replace ccode=347 if recipient=="Kosovo"
(2 real changes made)

. replace ccode=349 if recipient=="Slovenia"
(38 real changes made)

. replace ccode=350 if recipient=="Greece"
(339 real changes made)

. replace ccode=352 if recipient=="Cyprus"
(57 real changes made)

. replace ccode=355 if recipient=="Bulgaria"
(67 real changes made)

. replace ccode=359 if recipient=="Moldova"
(5 real changes made)

. replace ccode=360 if recipient=="Romania"
(120 real changes made)

. replace ccode=365 if recipient=="Russia"
(29 real changes made)

. replace ccode=365 if recipient=="Soviet Union"
(14 real changes made)

. replace ccode=365 if recipient=="USSR"
(0 real changes made)

. replace ccode=366 if recipient=="Estonia"
(49 real changes made)

. replace ccode=367 if recipient=="Latvia"
(40 real changes made)

. replace ccode=368 if recipient=="Lithuania"
(48 real changes made)

. replace ccode=369 if recipient=="Ukraine"
(13 real changes made)

. replace ccode=370 if recipient=="Belarus"
(31 real changes made)

. replace ccode=371 if recipient=="Armenia"
(50 real changes made)

. replace ccode=372 if recipient=="Georgia"
(68 real changes made)

. replace ccode=373 if recipient=="Azerbaijan"
(190 real changes made)

. replace ccode=375 if recipient=="Finland"
(164 real changes made)

. replace ccode=380 if recipient=="Sweden"
(95 real changes made)

. replace ccode=385 if recipient=="Norway"
(143 real changes made)

. replace ccode=390 if recipient=="Denmark"
(108 real changes made)

. replace ccode=390 if recipient=="Denmark"
(0 real changes made)

. replace ccode=395 if recipient=="Iceland"
(0 real changes made)

. replace ccode=402 if recipient=="Cape Verde"
(0 real changes made)

. replace ccode=402 if recipient=="Cabo Verde"
(4 real changes made)

. replace ccode=403 if recipient=="Sao Tome and Principe"
(0 real changes made)

. replace ccode=404 if recipient=="Guinea-Bissau"
(0 real changes made)

. replace ccode=411 if recipient=="Equatorial Guinea"
(18 real changes made)

. replace ccode=420 if recipient=="Gambia"
(1 real change made)

. replace ccode=420 if recipient=="Gambia, The"
(0 real changes made)

. replace ccode=432 if recipient=="Mali"
(36 real changes made)

. replace ccode=433 if recipient=="Senegal"
(45 real changes made)

. replace ccode=434 if recipient=="Benin"
(10 real changes made)

. replace ccode=435 if recipient=="Mauritania"
(24 real changes made)

. replace ccode=436 if recipient=="Niger"
(17 real changes made)

. replace ccode=437 if recipient=="Ivory Coast"
(0 real changes made)

. replace ccode=437 if recipient=="Côte d'Ivoire"
(0 real changes made)

. replace ccode=437 if recipient=="Cote d'Ivoire"
(34 real changes made)

. replace ccode=437 if recipient=="Cote d`Ivoire"
(0 real changes made)

. replace ccode=438 if recipient=="Guinea"
(21 real changes made)

. replace ccode=439 if recipient=="Burkina Faso"
(23 real changes made)

. replace ccode=450 if recipient=="Liberia"
(4 real changes made)

. replace ccode=451 if recipient=="Sierra Leone"
(15 real changes made)

. replace ccode=452 if recipient=="Ghana"
(42 real changes made)

. replace ccode=461 if recipient=="Togo"
(8 real changes made)

. replace ccode=471 if recipient=="Cameroon"
(46 real changes made)

. replace ccode=475 if recipient=="Nigeria"
(105 real changes made)

. replace ccode=481 if recipient=="Gabon"
(17 real changes made)

. replace ccode=482 if recipient=="Central African Republic"
(5 real changes made)

. replace ccode=482 if recipient=="Central African Rep."
(0 real changes made)

. replace ccode=482 if recipient=="Central African Rep"
(0 real changes made)

. replace ccode=483 if recipient=="Chad"
(51 real changes made)

. replace ccode=484 if recipient=="Congo"
(36 real changes made)

. replace ccode=484 if recipient=="Congo, Republic of the"
(0 real changes made)

. replace ccode=484 if recipient=="Congo, Republic of"
(0 real changes made)

. replace ccode=484 if recipient=="Congo, Rep."
(0 real changes made)

. replace ccode=484 if recipient=="Congo, Rep"
(0 real changes made)

. replace ccode=484 if recipient=="Congo-Brazzaville"
(0 real changes made)

. replace ccode=484 if recipient=="Congo, Brazzaville"
(0 real changes made)

. replace ccode=490 if recipient=="Democratic Republic of the Congo"
(0 real changes made)

. replace ccode=490 if recipient=="Democratic Republic of Congo"
(0 real changes made)

. replace ccode=490 if recipient=="Congo, Democratic Republic of the"
(0 real changes made)

. replace ccode=490 if recipient=="Congo, Democratic Republic"
(0 real changes made)

. replace ccode=490 if recipient=="Congo, Dem. Rep. of"
(0 real changes made)

. replace ccode=490 if recipient=="Congo, Dem. Rep."
(0 real changes made)

. replace ccode=490 if recipient=="Congo-Kinshasa"
(0 real changes made)

. replace ccode=490 if recipient=="Congo, DR"
(0 real changes made)

. replace ccode=490 if recipient=="DR Congo"
(43 real changes made)

. replace ccode=490 if recipient=="Zaire"
(0 real changes made)

. replace ccode=500 if recipient=="Uganda"
(74 real changes made)

. replace ccode=501 if recipient=="Kenya"
(33 real changes made)

. replace ccode=510 if recipient=="Tanzania"
(31 real changes made)

. replace ccode=511 if recipient=="Zanzibar"
(0 real changes made)

. replace ccode=516 if recipient=="Burundi"
(10 real changes made)

. replace ccode=517 if recipient=="Rwanda"
(30 real changes made)

. replace ccode=520 if recipient=="Somalia"
(13 real changes made)

. replace ccode=522 if recipient=="Djibouti"
(21 real changes made)

. replace ccode=530 if recipient=="Ethiopia"
(63 real changes made)

. replace ccode=531 if recipient=="Eritrea"
(31 real changes made)

. replace ccode=540 if recipient=="Angola"
(142 real changes made)

. replace ccode=541 if recipient=="Mozambique"
(15 real changes made)

. replace ccode=551 if recipient=="Zambia"
(28 real changes made)

. replace ccode=552 if recipient=="Zimbabwe"
(19 real changes made)

. replace ccode=553 if recipient=="Malawi"
(14 real changes made)

. replace ccode=560 if recipient=="South Africa"
(44 real changes made)

. replace ccode=565 if recipient=="Namibia"
(22 real changes made)

. replace ccode=570 if recipient=="Lesotho"
(11 real changes made)

. replace ccode=571 if recipient=="Botswana"
(41 real changes made)

. replace ccode=572 if recipient=="Swaziland"
(0 real changes made)

. replace ccode=572 if recipient=="eSwatini"
(2 real changes made)

. replace ccode=580 if recipient=="Madagascar"
(2 real changes made)

. replace ccode=581 if recipient=="Comoros"
(2 real changes made)

. replace ccode=590 if recipient=="Mauritius"
(5 real changes made)

. replace ccode=591 if recipient=="Seychelles"
(4 real changes made)

. replace ccode=600 if recipient=="Morocco"
(111 real changes made)

. replace ccode=615 if recipient=="Algeria"
(236 real changes made)

. replace ccode=616 if recipient=="Tunisia"
(49 real changes made)

. replace ccode=620 if recipient=="Libya"
(30 real changes made)

. replace ccode=625 if recipient=="Sudan"
(154 real changes made)

. replace ccode=626 if recipient=="South Sudan"
(17 real changes made)

. replace ccode=630 if recipient=="Iran"
(306 real changes made)

. replace ccode=630 if recipient=="Iran, Islamic Republic"
(0 real changes made)

. replace ccode=630 if recipient=="Iran, Ismalic Rep."
(0 real changes made)

. replace ccode=630 if recipient=="Iran, Ismalic Rep"
(0 real changes made)

. replace ccode=640 if recipient=="Turkey"
(0 real changes made)

. replace ccode=640 if recipient=="Turkiye"
(445 real changes made)

. replace ccode=645 if recipient=="Iraq"
(301 real changes made)

. replace ccode=651 if recipient=="Egypt"
(421 real changes made)

. replace ccode=651 if recipient=="Egypt, Arab Republic"
(0 real changes made)

. replace ccode=651 if recipient=="Egypt, Arab Rep."
(0 real changes made)

. replace ccode=652 if recipient=="Syria"
(123 real changes made)

. replace ccode=652 if recipient=="Syrian Arab Republic"
(0 real changes made)

. replace ccode=660 if recipient=="Lebanon"
(68 real changes made)

. replace ccode=663 if recipient=="Jordan"
(187 real changes made)

. replace ccode=666 if recipient=="Israel"
(186 real changes made)

. replace ccode=670 if recipient=="Saudi Arabia"
(480 real changes made)

. replace ccode=678 if recipient=="Yemen Arab Republic"
(0 real changes made)

. replace ccode=678 if recipient=="Yemen Arab Republic (North Yemen)"
(0 real changes made)

. replace ccode=678 if recipient=="North Yemen"
(0 real changes made)

. replace ccode=679 if recipient=="Yemen"
(75 real changes made)

. replace ccode=679 if recipient=="Yemen, Rep."
(0 real changes made)

. replace ccode=679 if recipient=="Yemen, Republic of"
(0 real changes made)

. replace ccode=680 if recipient=="Yemen People's Republic"
(0 real changes made)

. replace ccode=680 if recipient=="Yemen PDR"
(0 real changes made)

. replace ccode=680 if recipient=="South Yemen"
(1 real change made)

. replace ccode=690 if recipient=="Kuwait"
(146 real changes made)

. replace ccode=692 if recipient=="Bahrain"
(91 real changes made)

. replace ccode=694 if recipient=="Qatar"
(86 real changes made)

. replace ccode=696 if recipient=="United Arab Emirates"
(0 real changes made)

. replace ccode=696 if recipient=="UAE"
(412 real changes made)

. replace ccode=698 if recipient=="Oman"
(117 real changes made)

. replace ccode=700 if recipient=="Afghanistan"
(132 real changes made)

. replace ccode=701 if recipient=="Turkmenistan"
(55 real changes made)

. replace ccode=702 if recipient=="Tajikistan"
(18 real changes made)

. replace ccode=703 if recipient=="Kyrgyzstan"
(10 real changes made)

. replace ccode=703 if recipient=="Kyrgyz Republic"
(0 real changes made)

. replace ccode=704 if recipient=="Uzbekistan"
(20 real changes made)

. replace ccode=705 if recipient=="Kazakhstan"
(108 real changes made)

. replace ccode=710 if recipient=="China"
(348 real changes made)

. replace ccode=710 if recipient=="China, People's Republic"
(0 real changes made)

. replace ccode=710 if recipient=="China, People's Rep."
(0 real changes made)

. replace ccode=710 if recipient=="China, People's Rep"
(0 real changes made)

. replace ccode=710 if recipient=="China, PRC"
(0 real changes made)

. replace ccode=710 if recipient=="China,P.R.: Mainland"
(0 real changes made)

. replace ccode=712 if recipient=="Mongolia"
(8 real changes made)

. replace ccode=713 if recipient=="Taiwan"
(195 real changes made)

. replace ccode=713 if recipient=="Taiwan, China"
(0 real changes made)

. replace ccode=730 if recipient=="Korea"
(0 real changes made)

. replace ccode=731 if recipient=="North Korea"
(100 real changes made)

. replace ccode=731 if recipient=="Korea, Democratic Republic"
(0 real changes made)

. replace ccode=731 if recipient=="Democratic People's Republic of Korea"
(0 real changes made)

. replace ccode=731 if recipient=="Korea, Dem. Rep."
(0 real changes made)

. replace ccode=732 if recipient=="South Korea"
(368 real changes made)

. replace ccode=732 if recipient=="Korea"
(0 real changes made)

. replace ccode=732 if recipient=="Korea, Republic of"
(0 real changes made)

. replace ccode=732 if recipient=="Republic of Korea"
(0 real changes made)

. replace ccode=732 if recipient=="Korea, Rep."
(0 real changes made)

. replace ccode=740 if recipient=="Japan"
(486 real changes made)

. replace ccode=750 if recipient=="India"
(733 real changes made)

. replace ccode=760 if recipient=="Bhutan"
(3 real changes made)

. replace ccode=770 if recipient=="Pakistan"
(544 real changes made)

. replace ccode=771 if recipient=="Bangladesh"
(128 real changes made)

. replace ccode=775 if recipient=="Myanmar"
(184 real changes made)

. replace ccode=780 if recipient=="Sri Lanka"
(98 real changes made)

. replace ccode=781 if recipient=="Maldives"
(5 real changes made)

. replace ccode=790 if recipient=="Nepal"
(30 real changes made)

. replace ccode=800 if recipient=="Thailand"
(281 real changes made)

. replace ccode=811 if recipient=="Cambodia"
(44 real changes made)

. replace ccode=812 if recipient=="Laos"
(30 real changes made)

. replace ccode=812 if recipient=="Lao People's Dem.Rep"
(0 real changes made)

. replace ccode=816 if recipient=="Vietnam"
(0 real changes made)

. replace ccode=816 if recipient=="Viet Nam"
(150 real changes made)

. replace ccode=816 if recipient=="Viet Minh (France)*"
(0 real changes made)

. replace ccode=816 if recipient=="Democratic Republic of Vietnam"
(0 real changes made)

. replace ccode=817 if recipient=="Republic of Vietnam"
(0 real changes made)

. replace ccode=817 if recipient=="Vietnam, Republic of"
(0 real changes made)

. replace ccode=817 if recipient=="Viet Cong (South Vietnam)*"
(0 real changes made)

. replace ccode=817 if recipient=="South Vietnam"
(0 real changes made)

. replace ccode=820 if recipient=="Malaysia"
(171 real changes made)

. replace ccode=830 if recipient=="Singapore"
(228 real changes made)

. replace ccode=835 if recipient=="Brunei"
(17 real changes made)

. replace ccode=840 if recipient=="Philippines"
(92 real changes made)

. replace ccode=850 if recipient=="Indonesia"
(271 real changes made)

. replace ccode=860 if recipient=="East Timor"
(0 real changes made)

. replace ccode=860 if recipient=="Timor-Leste"
(0 real changes made)

. replace ccode=900 if recipient=="Australia"
(287 real changes made)

. replace ccode=910 if recipient=="Papua New Guinea"
(7 real changes made)

. replace ccode=920 if recipient=="New Zealand"
(44 real changes made)

. replace ccode=935 if recipient=="Vanuatu"
(0 real changes made)

. replace ccode=940 if recipient=="Solomon Islands"
(0 real changes made)

. replace ccode=946 if recipient=="Kiribati"
(0 real changes made)

. replace ccode=947 if recipient=="Tuvalu"
(0 real changes made)

. replace ccode=950 if recipient=="Fiji"
(3 real changes made)

. replace ccode=955 if recipient=="Tonga"
(1 real change made)

. replace ccode=970 if recipient=="Nauru"
(0 real changes made)

. replace ccode=983 if recipient=="Marshall Islands"
(0 real changes made)

. replace ccode=986 if recipient=="Palau"
(0 real changes made)

. replace ccode=987 if recipient=="Federated States of Micronesia"
(0 real changes made)

. replace ccode=987 if recipient=="Micronesia"
(0 real changes made)

. replace ccode=987 if recipient=="Micronesia, Fed. Sts."
(0 real changes made)

. replace ccode=990 if recipient=="Samoa"
(0 real changes made)

. 
end of do-file

. 
. drop if missing(ccode)
(246 observations deleted)

. 
. sort ccode year

. 
. collapse (sum) tivdeliveryvalues, by(ccode year)

. 
. save "originals/sipri_filtered_collapsed_plus.dta", replace
file originals/sipri_filtered_collapsed_plus.dta saved

. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. use "temps/c5_p2.dta"

. 
. merge 1:1 ccode year using originals/sipri_filtered_collapsed.dta

    Result                      Number of obs
    -----------------------------------------
    Not matched                         1,972
        from master                     1,662  (_merge==1)
        from using                        310  (_merge==2)

    Matched                             2,727  (_merge==3)
    -----------------------------------------

. 
. drop if _merge == 2
(310 observations deleted)

. drop _merge 

. drop if year > 2018
(0 observations deleted)

. 
. rename tivdeliveryvalues self_pampPLUSTIV

. 
. order ccode year ln_BR_deaths ln_neigh_MCW arms_sanctioned ln_conflict_MCW lastyear year_of_conflict ln_GDP_pc ln_population polity ethn
> ic self_pampTIV self_pampPLUSTIV self_TIV

. 
. save "temps/c5_p3.dta", replace
file temps/c5_p3.dta saved

. 
. **# MERGING CSHAPES AND NEIGHBOURS' SIPRI TIVs
. /*
> 1 = microstates (monaco, liechtenstein, andorra, and san marino) - not included in SIPRI??
> 2 = no neighbours, either due to no land border or country/data didn't exist in that year
> 3 = match
> */ 
. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. use "temps/cshapes_mod.dta"

. merge m:1 ccode year using originals/sipri_filtered_collapsed_plus.dta
(variable ccode was int, now float to accommodate using data's values)

    Result                      Number of obs
    -----------------------------------------
    Not matched                         7,182
        from master                     6,872  (_merge==1)
        from using                        310  (_merge==2)

    Matched                            11,638  (_merge==3)
    -----------------------------------------

. 
. drop if (year<1989 | year>2018)
(624 observations deleted)

. keep if _merge == 3
(6,558 observations deleted)

. drop _merge

. 
. rename ccode neighbour

. rename tivdeliveryvalues neighbour_TIV

. 
. save "temps/cshapes_sipri_filtered_plus.dta", replace
file temps/cshapes_sipri_filtered_plus.dta saved

. 
. **# GENERATING COLLECTIVE IMPORTS
. /*
> summing up a country's neighbours' TIVs for a particular year. this generates duplicates where the country has multiple neighbours, so d
> ropped the duplicate observations. neighbour ccodes are also no longer necessary as each instance of the referent country should have th
> e same collective TIV
> */
. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. use "temps/cshapes_sipri_filtered_plus.dta"

. 
. egen collective_pampPLUSTIV = total(neighbour_TIV), by(referent year)

. 
. drop neighbour_TIV neighbour

. duplicates drop

Duplicates in terms of all variables

(7,443 observations deleted)

. 
. rename referent ccode

. sort ccode year

. 
. save "temps/sipri_coll_filtered_plus.dta", replace
file temps/sipri_coll_filtered_plus.dta saved

. 
. **# MERGING COLLECTIVE INTO THE DATASET
. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. use "temps/c5_p3.dta"

. 
. merge 1:1 ccode year using temps/sipri_coll_filtered_plus.dta

    Result                      Number of obs
    -----------------------------------------
    Not matched                           402
        from master                       298  (_merge==1)
        from using                        104  (_merge==2)

    Matched                             4,091  (_merge==3)
    -----------------------------------------

. 
. drop if _merge == 2
(104 observations deleted)

. drop _merge

. 
. order ccode year ln_BR_deaths ln_neigh_MCW arms_sanctioned ln_conflict_MCW lastyear year_of_conflict ln_GDP_pc ln_population polity ethn
> ic self_pampTIV self_pampPLUSTIV self_TIV collective_pampTIV collective_pampPLUSTIV collective_TIV

. 
. replace self_pampPLUSTIV = self_pampPLUSTIV * 100
(2,727 real changes made)

. replace collective_pampPLUSTIV = collective_pampPLUSTIV * 100
(4,091 real changes made)

. 
. gen ln_neigh_PAMPplus = ln(collective_pampPLUSTIV)
(298 missing values generated)

. gen ln_conflict_PAMPplus = ln(self_pampPLUSTIV)
(1,662 missing values generated)

. 
. label var ln_neigh_PAMPplus "ln(Neighbours' MCW Imports)"

. label var ln_conflict_PAMPplus "ln(Conflict Country MCW Imports)"

. 
. label var ln_neigh_PAMP "ln(Neighbours' MCW Imports)"

. label var ln_conflict_PAMP "ln(Conflict Country MCW Imports)"

. 
. save "temps/c5_p4.dta", replace
file temps/c5_p4.dta saved

. 
. clear

. cd "/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files"
/Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files

. use "temps/c5_p4.dta"

. 
. xtset ccode year, yearly

Panel variable: ccode (unbalanced)
 Time variable: year, 1989 to 2018
         Delta: 1 year

. 
. gen lag_arms = l.arms_sanctioned
(156 missing values generated)

. gen lag_gdppc = l.ln_GDP_pc
(293 missing values generated)

. 
. label var lag_arms "Arms Sanctions, lagged"

. label var lag_gdppc "ln(GDP per capita), lagged"

. 
. save "temps/c6", replace
file temps/c6.dta saved

. 
. 
. log close
      name:  <unnamed>
       log:  /Users/alex/Documents/0University/0Modules/Year 4/PIED3769 Q Diss/Data/files/stata_log_data.log
  log type:  text
 closed on:   7 May 2025, 20:53:01
------------------------------------------------------------------------------------------------------------------------------------------
